mirror of https://github.com/lukechilds/node.git
Browse Source
PR-URL: https://github.com/nodejs/node/pull/6774 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Refs: https://github.com/nodejs/node/pull/6768v6.x
committed by
Rod Vagg
2 changed files with 33 additions and 0 deletions
@ -0,0 +1,32 @@ |
|||||
|
/** |
||||
|
* @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