Skip to content

eslint/no-sparse-arrays Correctness

This rule is turned on by default.

What it does

Disallow sparse arrays.

Why is this bad?

The confusion around sparse arrays is enough that it’s recommended to avoid using them unless you are certain that they are useful in your code.

Example

javascript
var items = [, ,];
var colors = ["red", , "blue"];

References

Released under the MIT License.