Skip to content

Commit 0397fcb

Browse files
authored
fix: require whitespace after @const tag (#11379)
1 parent eb7e32c commit 0397fcb

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

.changeset/six-boats-shave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte": patch
3+
---
4+
5+
fix: require whitespace after `@const` tag

packages/svelte/src/compiler/phases/1-parse/state/tag.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ function special(parser) {
543543
}
544544

545545
if (parser.eat('const')) {
546-
parser.allow_whitespace();
546+
parser.require_whitespace();
547547

548548
const id = read_pattern(parser);
549549
parser.allow_whitespace();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { test } from '../../test';
2+
3+
export default test({
4+
error: {
5+
code: 'expected_whitespace',
6+
message: 'Expected whitespace',
7+
position: [19, 19]
8+
}
9+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{#if true}
2+
{@constfoo = 'bar'}
3+
{/if}

0 commit comments

Comments
 (0)