mirror of https://github.com/lukechilds/node.git
Browse Source
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>v6.x
Rich Trott
8 years ago
committed by
Myles Borins
2 changed files with 6 additions and 33 deletions
@ -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.`); |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
} |
|||
}; |
Loading…
Reference in new issue