Skip to content

unicorn/no-unnecessary-array-flat-depth Pedantic ​

🚧 An auto-fix is still under development.

What it does ​

Disallows passing 1 to Array.prototype.flat

Why is this bad? ​

Passing 1 is unnecessary.

Examples ​

Examples of incorrect code for this rule:

js
foo.flat(1);

Examples of correct code for this rule:

js
foo.flat();

How to use ​

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny unicorn/no-unnecessary-array-flat-depth
json
{
  "rules": {
    "unicorn/no-unnecessary-array-flat-depth": "error"
  }
}

References ​

Released under the MIT License.