2 * @fileoverview Disallow construction of dense arrays using the Array constructor
3 * @author Matt DuVall <http://www.mattduvall.com/>
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
17 description: "disallow `Array` constructors",
18 category: "Stylistic Issues",
20 url: "https://eslint.org/docs/rules/no-array-constructor"
26 preferLiteral: "The array literal notation [] is preferable."
33 * Disallow construction of dense arrays using the Array constructor
34 * @param {ASTNode} node node to evaluate
38 function check(node) {
40 node.arguments.length !== 1 &&
41 node.callee.type === "Identifier" &&
42 node.callee.name === "Array"
44 context.report({ node, messageId: "preferLiteral" });
49 CallExpression: check,