Skip to content

Commit c5c3b21

Browse files
not-an-aardvarkilyavolodin
authored andcommitted
Fix: no-implied-eval false positive on 'setTimeoutFoo' (fixes #7821) (#7836)
1 parent 00dd96c commit c5c3b21

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

lib/rules/no-implied-eval.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
},
2222

2323
create(context) {
24-
const CALLEE_RE = /set(?:Timeout|Interval)|execScript/;
24+
const CALLEE_RE = /^(setTimeout|setInterval|execScript)$/;
2525

2626
/*
2727
* Figures out if we should inspect a given binary expression. Is a stack

tests/lib/rules/no-implied-eval.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ ruleTester.run("no-implied-eval", rule, {
5353
"setTimeout(foobar, foo + 'bar')",
5454

5555
// only checks immediate subtrees of the argument
56-
"setTimeout(function() { return 'foobar'; }, 10)"
56+
"setTimeout(function() { return 'foobar'; }, 10)",
57+
58+
// https://github.com/eslint/eslint/issues/7821
59+
"setTimeoutFooBar('Foo Bar')"
5760
],
5861

5962
invalid: [

0 commit comments

Comments
 (0)