Skip to content

Commit 3114dd9

Browse files
authored
prefer-single-call: Fix crash on CallExpression followed by FunctionDeclaration (#2639)
1 parent 3838ec8 commit 3114dd9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

rules/prefer-single-call.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const cases = [
6767
},
6868
].map(problematicalCase => ({
6969
...problematicalCase,
70-
test: callExpression => isExpressionStatement(callExpression) && problematicalCase.test(callExpression),
70+
test: callExpression => problematicalCase.test(callExpression) && isExpressionStatement(callExpression),
7171
}));
7272

7373
function create(context) {

test/prefer-single-call.js

+4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ test.snapshot({
8686
],
8787
},
8888
'for (const _ of []) foo.push(bar);',
89+
outdent`
90+
function bar() {}
91+
foo.push(bindEvents);
92+
`,
8993
],
9094
invalid: [
9195
outdent`

0 commit comments

Comments
 (0)