💼 This rule is enabled in the ✅ recommended
config.
When calling Array#flat(depth)
, the depth argument should normally be 1
or Infinity
, otherwise it should be a meaningful variable name or explained with a comment.
const foo = array.flat(2);
const foo = array.flat(99);
const foo = array.flat();
const foo = array.flat(Number.POSITIVE_INFINITY);
const foo = array.flat(Infinity);
const foo = array.flat(depth);
const foo = array.flat(/* The depth is always 2 */ 2);