diff options
author | Rich Trott <rtrott@gmail.com> | 2017-04-08 19:43:59 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-04-12 13:07:39 -0700 |
commit | b3f2e3b7e2793e1f74cd296e85a549d926054225 (patch) | |
tree | 80bdf2a4a00cd9f38679dd77bac1ab9a23a453fa /tools | |
parent | 0ec0272e107e26c9740f33baade3cbe10a321fa3 (diff) | |
download | node-new-b3f2e3b7e2793e1f74cd296e85a549d926054225.tar.gz |
tools: replace custom assert.fail lint rule
Replace custom lint rule for `assert.fail()` function signature errors
with a restricted-syntax rule.
PR-URL: https://github.com/nodejs/node/pull/12287
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/eslint-rules/assert-fail-single-argument.js | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/tools/eslint-rules/assert-fail-single-argument.js b/tools/eslint-rules/assert-fail-single-argument.js deleted file mode 100644 index 4ce7902381..0000000000 --- a/tools/eslint-rules/assert-fail-single-argument.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @fileoverview Prohibit use of a single argument only in `assert.fail()`. It - * is almost always an error. - * @author Rich Trott - */ -'use strict'; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const msg = 'assert.fail() message should be third argument'; - -function isAssert(node) { - return node.callee.object && node.callee.object.name === 'assert'; -} - -function isFail(node) { - return node.callee.property && node.callee.property.name === 'fail'; -} - -module.exports = function(context) { - return { - 'CallExpression': function(node) { - if (isAssert(node) && isFail(node) && node.arguments.length === 1) { - context.report(node, msg); - } - } - }; -}; |