Sha256: 17f0ff3b150f729bafe716fc9662bf7f244efe52435f1f280984a086e7085c8a
Contents?: true
Size: 955 Bytes
Versions: 2
Compression:
Stored size: 955 Bytes
Contents
/** * @fileoverview Disallow construction of dense arrays using the Array constructor * @author Matt DuVall <http://www.mattduvall.com/> */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = function(context) { /** * Disallow construction of dense arrays using the Array constructor * @param {ASTNode} node node to evaluate * @returns {void} * @private */ function check(node) { if ( node.arguments.length !== 1 && node.callee.type === "Identifier" && node.callee.name === "Array" ) { context.report(node, "The array literal notation [] is preferrable."); } } return { "CallExpression": check, "NewExpression": check }; }; module.exports.schema = [];
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eslint_node_modules-1.6.0.1 | vendor/node_modules/eslint/lib/rules/no-array-constructor.js |
eslint_node_modules-1.6.0 | vendor/node_modules/eslint/lib/rules/no-array-constructor.js |