4d96eb3e92537e93f1ea2a6198bb890747830e2d
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview Rule to flag references to the undefined variable.
3  * @author Michael Ficarra
4  */
5 "use strict";
6
7 //------------------------------------------------------------------------------
8 // Rule Definition
9 //------------------------------------------------------------------------------
10
11 module.exports = function(context) {
12
13     return {
14
15         "Identifier": function(node) {
16             if (node.name === "undefined") {
17                 var parent = context.getAncestors().pop();
18                 if (!parent || parent.type !== "MemberExpression" || node !== parent.property || parent.computed) {
19                     context.report(node, "Unexpected use of undefined.");
20                 }
21             }
22         }
23     };
24
25 };