mirror of https://github.com/lukechilds/node.git
Browse Source
ESLint 3.5.0 introduces a `no-restricted-properties` rule. Replace our custom `no-deepEqual` rule with this rule. PR-URL: https://github.com/nodejs/node/pull/8478 Reviewed-By: James M Snell <jasnell@gmail.com>v7.x
Rich Trott
8 years ago
13 changed files with 16 additions and 43 deletions
@ -1,32 +0,0 @@ |
|||||
/** |
|
||||
* @fileoverview Prohibit use of assert.deepEqual() |
|
||||
* @author Rich Trott |
|
||||
* |
|
||||
* This rule is imperfect, but will find the most common forms of |
|
||||
* assert.deepEqual() usage. |
|
||||
*/ |
|
||||
'use strict'; |
|
||||
|
|
||||
//------------------------------------------------------------------------------
|
|
||||
// Rule Definition
|
|
||||
//------------------------------------------------------------------------------
|
|
||||
|
|
||||
const msg = 'assert.deepEqual() disallowed. Use assert.deepStrictEqual()'; |
|
||||
|
|
||||
function isAssert(node) { |
|
||||
return node.callee.object && node.callee.object.name === 'assert'; |
|
||||
} |
|
||||
|
|
||||
function isDeepEqual(node) { |
|
||||
return node.callee.property && node.callee.property.name === 'deepEqual'; |
|
||||
} |
|
||||
|
|
||||
module.exports = function(context) { |
|
||||
return { |
|
||||
'CallExpression': function(node) { |
|
||||
if (isAssert(node) && isDeepEqual(node)) { |
|
||||
context.report(node, msg); |
|
||||
} |
|
||||
} |
|
||||
}; |
|
||||
}; |
|
Loading…
Reference in new issue