Skip to main content

noSparseArray (since v0.7.0)

Disallow sparse arrays

Examples

Invalid

[1,,2]
warning[js/noSparseArray]: This array contains an empty slot.
  ┌─ js/noSparseArray.js:1:1
  │
1 │ [1,,2]
  │ ------

Suggested fix: Replace hole with undefined
    | @@ -1 +1 @@
0   | - [1,,2]
  0 | + [1, undefined,2]