Skip to content

unicorn/no-unreadable-array-destructuring Style

What it does

Disallow unreadable array destructuring

Why is this bad?

Destructuring is very useful, but it can also make some code harder to read. This rule prevents ignoring consecutive values when destructuring from an array.

Example

Examples of incorrect code for this rule:

javascript
const [, , foo] = parts;

Examples of correct code for this rule:

javascript
const [foo] = parts;

How to use

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

bash
oxlint --deny unicorn/no-unreadable-array-destructuring
json
{
  "rules": {
    "unicorn/no-unreadable-array-destructuring": "error"
  }
}

References

Released under the MIT License.