mirror of https://github.com/lukechilds/node.git
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.
32 lines
900 B
32 lines
900 B
/**
|
|
* @fileoverview Rule to flag usage of __defineGetter__ and __defineSetter__
|
|
* @author Rich Trott
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Rule Definition
|
|
//------------------------------------------------------------------------------
|
|
|
|
module.exports = {
|
|
create: function(context) {
|
|
const disallowed = ['__defineGetter__', '__defineSetter__'];
|
|
|
|
return {
|
|
MemberExpression: function(node) {
|
|
var prop;
|
|
if (node.property) {
|
|
if (node.property.type === 'Identifier' && !node.computed) {
|
|
prop = node.property.name;
|
|
} else if (node.property.type === 'Literal') {
|
|
prop = node.property.value;
|
|
}
|
|
if (disallowed.includes(prop)) {
|
|
context.report(node, `The ${prop} property is deprecated.`);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
}
|
|
};
|
|
|