143097713f08d66cfc142db2f1a64568e42a7ca2
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview Disallow sparse arrays
3  * @author Nicholas C. Zakas
4  */
5 "use strict";
6
7 //------------------------------------------------------------------------------
8 // Rule Definition
9 //------------------------------------------------------------------------------
10
11 module.exports = function(context) {
12
13
14     //--------------------------------------------------------------------------
15     // Public
16     //--------------------------------------------------------------------------
17
18     return {
19
20         "ArrayExpression": function(node) {
21
22             var emptySpot = node.elements.indexOf(null) > -1;
23
24             if (emptySpot) {
25                 context.report(node, "Unexpected comma in middle of array.");
26             }
27         }
28
29     };
30
31 };