File tree 2 files changed +20
-5
lines changed
2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -112,16 +112,15 @@ export default util.createRule({
112
112
case AST_NODE_TYPES . FunctionExpression :
113
113
return true ;
114
114
115
- case AST_NODE_TYPES . MemberExpression :
116
- case AST_NODE_TYPES . Identifier :
117
- case AST_NODE_TYPES . ConditionalExpression :
118
- return isFunctionType ( node ) ;
115
+ case AST_NODE_TYPES . Literal :
116
+ case AST_NODE_TYPES . TemplateLiteral :
117
+ return false ;
119
118
120
119
case AST_NODE_TYPES . CallExpression :
121
120
return isBind ( node . callee ) || isFunctionType ( node ) ;
122
121
123
122
default :
124
- return false ;
123
+ return isFunctionType ( node ) ;
125
124
}
126
125
}
127
126
Original file line number Diff line number Diff line change @@ -256,6 +256,7 @@ const foo = () => {};
256
256
const bar = () => {};
257
257
258
258
setTimeout(Math.radom() > 0.5 ? foo : bar, 0);
259
+ setTimeout(foo || bar, 500);
259
260
` ,
260
261
`
261
262
class Foo {
@@ -816,6 +817,21 @@ globalThis['execScript'](\`\`);
816
817
} ,
817
818
] ,
818
819
} ,
820
+ {
821
+ code : `
822
+ const foo: string | undefined = 'hello';
823
+ const bar = () => {};
824
+
825
+ setTimeout(foo || bar, 500);
826
+ ` ,
827
+ errors : [
828
+ {
829
+ messageId : 'noImpliedEvalError' ,
830
+ line : 5 ,
831
+ column : 12 ,
832
+ } ,
833
+ ] ,
834
+ } ,
819
835
{
820
836
code : 'const fn = Function();' ,
821
837
errors : [
You can’t perform that action at this time.
0 commit comments