]>
git.proxmox.com Git - pve-eslint.git/blob - eslint/lib/rules/no-array-constructor.js
2 * @fileoverview Disallow construction of dense arrays using the Array constructor
3 * @author Matt DuVall <http://www.mattduvall.com/>
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
12 /** @type {import('../shared/types').Rule} */
18 description
: "Disallow `Array` constructors",
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
,