0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/tools/eslint-rules
Michaël Zasso 0ae1684396 tools: add ESLint rule for assert.throws arguments
The second argument to "assert.throws" is usually a validation RegExp or
function for the thrown error. However, the function also accepts a
string and in this case it is interpreted as a message for the
AssertionError and not used for validation. It is common for people to
forget this and pass a validation string by mistake.
This new rule checks that we never pass a string literal as a second argument
to "assert.throws". Additionally, there is an option to enforce the
function to be called with at least two arguments. It is currently off
because we have many tests that do not comply with this rule.

PR-URL: https://github.com/nodejs/node/pull/10089
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2016-12-05 16:01:12 +01:00
..
align-function-arguments.js tools: make argument alignment linting more strict 2016-09-20 10:22:23 -07:00
align-multiline-assignment.js tools: remove default parameters from lint rule 2016-04-28 22:48:37 -07:00
assert-fail-single-argument.js tools: lint rule for assert.fail() 2016-04-20 08:36:27 -07:00
assert-throws-arguments.js tools: add ESLint rule for assert.throws arguments 2016-12-05 16:01:12 +01:00
buffer-constructor.js tools: add buffer-constructor eslint rule 2016-03-18 17:05:18 -07:00
new-with-error.js tools: remove obsolete lint rules 2016-02-18 10:13:03 -08:00
no-let-in-for-declaration.js tools: avoid let in for loops 2016-10-14 13:37:12 -07:00
no-useless-regex-char-class-escape.js tools: Add no useless regex char class rule 2016-11-23 22:06:37 -08:00
prefer-assert-methods.js tools: add eslint rule prefer-assert-methods 2016-09-20 16:35:39 -07:00
require-buffer.js tools: remove obsolete lint rules 2016-02-18 10:13:03 -08:00
required-modules.js tools: remove obsolete lint rules 2016-02-18 10:13:03 -08:00