1 | /**
|
2 | * @fileoverview Rule to flag references to the undefined variable.
|
3 | * @author Michael Ficarra
|
4 | */
|
5 | ;
|
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 | };
|
26 |
|
27 | module.exports.schema = [];
|