2 * @fileoverview Disallow sparse arrays
3 * @author Nicholas C. Zakas
7 //------------------------------------------------------------------------------
9 //------------------------------------------------------------------------------
16 description: "disallow sparse arrays",
17 category: "Possible Errors",
19 url: "https://eslint.org/docs/rules/no-sparse-arrays"
25 unexpectedSparseArray: "Unexpected comma in middle of array."
32 //--------------------------------------------------------------------------
34 //--------------------------------------------------------------------------
38 ArrayExpression(node) {
40 const emptySpot = node.elements.indexOf(null) > -1;
43 context.report({ node, messageId: "unexpectedSparseArray" });