You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
/**
|
|
|
|
* @fileoverview Rule to flag references to the undefined variable.
|
|
|
|
* @author Michael Ficarra
|
|
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Rule Definition
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
module.exports = function(context) {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
"Identifier": function(node) {
|
|
|
|
if (node.name === "undefined") {
|
|
|
|
var parent = context.getAncestors().pop();
|
|
|
|
if (!parent || parent.type !== "MemberExpression" || node !== parent.property || parent.computed) {
|
|
|
|
context.report(node, "Unexpected use of undefined.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.schema = [];
|