no-magic-array-flat-depth
UnreleasedConfiguration
rslint.config.ts
Rule Details
Disallow a magic number as the depth argument in Array#flat(…).
Array#flat() is often used to flatten deeply nested arrays, but using a
hard-coded depth like flat(2) or flat(99) is usually a sign the caller
doesn't know the array's structure. Prefer flat(Infinity) for "fully flatten"
or restructure the data so the depth is implicit.
Examples of incorrect code for this rule:
Examples of correct code for this rule: