diff options
author | Michaël Zasso <targos@protonmail.com> | 2016-12-16 09:34:25 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2016-12-19 08:04:36 +0100 |
commit | 7cb98138a9bd5b87010c49011e281ee4c4024eec (patch) | |
tree | 2c0df46bafa8b6e0873d748f8514573afa8bff18 /tools | |
parent | 348e69c89de658d1ea2b386f4166370214c25e95 (diff) | |
download | android-node-v8-7cb98138a9bd5b87010c49011e281ee4c4024eec.tar.gz android-node-v8-7cb98138a9bd5b87010c49011e281ee4c4024eec.tar.bz2 android-node-v8-7cb98138a9bd5b87010c49011e281ee4c4024eec.zip |
tools: forbid template literals in assert.throws
Extend the assert-throws-arguments custom ESLint rule to also check for
the use of template literals as a second argument to assert.throws.
PR-URL: https://github.com/nodejs/node/pull/10301
Ref: https://github.com/nodejs/node/pull/10282#discussion_r92607290
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/eslint-rules/assert-throws-arguments.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/eslint-rules/assert-throws-arguments.js b/tools/eslint-rules/assert-throws-arguments.js index 434a0ca455..3b51188c0c 100644 --- a/tools/eslint-rules/assert-throws-arguments.js +++ b/tools/eslint-rules/assert-throws-arguments.js @@ -21,7 +21,8 @@ function checkThrowsArguments(context, node) { }); } else if (args.length > 1) { const error = args[1]; - if (error.type === 'Literal' && typeof error.value === 'string') { + if (error.type === 'Literal' && typeof error.value === 'string' || + error.type === 'TemplateLiteral') { context.report({ message: 'Unexpected string as second argument', node: error |