diff --git a/.eslintrc.yaml b/.eslintrc.yaml index d805997f05ec74..21ed2b558cbd37 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -113,6 +113,9 @@ rules: }, { selector: "ThrowStatement > CallExpression[callee.name=/Error$/]", message: "Use new keyword when throwing an Error." + }, { + selector: "CallExpression[callee.object.name='assert'][callee.property.name='fail'][arguments.length=1]", + message: "assert.fail() message should be third argument" }] no-tabs: 2 no-trailing-spaces: 2 @@ -143,7 +146,6 @@ rules: # Custom rules in tools/eslint-rules align-multiline-assignment: 2 - assert-fail-single-argument: 2 assert-throws-arguments: [2, { requireTwo: false }] no-useless-regex-char-class-escape: [2, { override: ['[', ']'] }] 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 4ce790238181cc..00000000000000 --- 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); - } - } - }; -};