Skip to content

Commit e355604

Browse files
committed
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: #10301 Ref: #10282 (comment) Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
1 parent 9c85d0f commit e355604

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎tools/eslint-rules/assert-throws-arguments.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ function checkThrowsArguments(context, node){
2121
});
2222
}elseif(args.length>1){
2323
consterror=args[1];
24-
if(error.type==='Literal'&&typeoferror.value==='string'){
24+
if(error.type==='Literal'&&typeoferror.value==='string'||
25+
error.type==='TemplateLiteral'){
2526
context.report({
2627
message: 'Unexpected string as second argument',
2728
node: error

0 commit comments

Comments
(0)