Skip to content

Commit b4911aa

Browse files
authored
fix(consistent-list-newline): correct end range for if statement (#48)
1 parent 542567d commit b4911aa

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/rules/consistent-list-newline.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ import rule, { RULE_NAME } from './consistent-list-newline'
88
const valids: ValidTestCase[] = [
99
'if (a) {}',
1010
'if (\na\n) {}',
11+
$`
12+
if (true
13+
&& true) {
14+
obj.a = ''
15+
obj.b = true
16+
}
17+
`,
1118
'const a = { foo: "bar", bar: 2 }',
1219
'const a = {\nfoo: "bar",\nbar: 2\n}',
1320
'const a = [1, 2, 3]',

src/rules/consistent-list-newline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export default createEslintRule<Options, MessageIds>({
266266
)
267267
},
268268
IfStatement: (node) => {
269-
check(node, [node.test])
269+
check(node, [node.test], node.consequent)
270270
},
271271
ArrowFunctionExpression: (node) => {
272272
if (node.params.length <= 1)

0 commit comments

Comments
 (0)