prefer-array-flat
Configuration
rslint.config.ts
Rule Details
Prefer Array#flat() over legacy techniques that flatten arrays with identity
flatMap callbacks, reduce, concat, Lodash, Underscore, or configured
helper functions.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
[maybeArray].flat() preserves the behavior of [].concat(maybeArray) when
the value may be either a single item or an array.
Options
functions
Type: string[]
Default: []
Adds custom flattening functions. _.flatten(), lodash.flatten(), and
underscore.flatten() are always checked.
Examples of incorrect code for this rule with this option: