Skip to content

Commit 665cda4

Browse files
committed
Fix else block location
1 parent 6f66a88 commit 665cda4

File tree

5 files changed

+743
-1
lines changed

5 files changed

+743
-1
lines changed

src/parser/converts/block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function convertIfBlock(
4949
return ifBlock
5050
}
5151

52-
const elseStart = ctx.code.lastIndexOf("{", node.else.start)
52+
const elseStart = ctx.code.lastIndexOf("{", node.else.start - 1)
5353

5454
const elseBlock: SvelteElseBlock = {
5555
type: "SvelteElseBlock",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{#if expression}{:else if expression}{:else}{/if}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"ruleId": "no-undef",
4+
"code": "expression",
5+
"line": 1,
6+
"column": 6
7+
},
8+
{
9+
"ruleId": "no-undef",
10+
"code": "expression",
11+
"line": 1,
12+
"column": 27
13+
}
14+
]

0 commit comments

Comments
 (0)