mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
tools: replace custom lint rule for getter/setter
Replace custom `no-definegetter-definesetter` lint rule with ESLint's built-in `no-restricted-properties`. Refs: https://github.com/nodejs/node/pull/9112#pullrequestreview-4378536 PR-URL: https://github.com/nodejs/node/pull/9194 Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit is contained in:
1 parent
3184285630
commit
3dbf900e85
2 files changed
+6
-33
No files matched your search
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* @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.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user