π Disallow a magic number as the depth argument in Array#flat(β¦)..
πΌ This rule is enabled in the following configs: β
recommended, βοΈ unopinionated.
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);