a37d674c807eceb6e6cb97ffb6be301e42392809
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview Disallow construction of dense arrays using the Array constructor
3  * @author Matt DuVall <http://www.mattduvall.com/>
4  */
5
6 "use strict";
7
8 //------------------------------------------------------------------------------
9 // Rule Definition
10 //------------------------------------------------------------------------------
11
12 module.exports = function(context) {
13
14     function check(node) {
15         if (
16             node.arguments.length !== 1 &&
17             node.callee.type === "Identifier" &&
18             node.callee.name === "Array"
19         ) {
20             context.report(node, "The array literal notation [] is preferrable.");
21         }
22     }
23
24     return {
25         "CallExpression": check,
26         "NewExpression": check
27     };
28
29 };