Skip to content

Commit

Permalink
fix: require whitespace after @const tag (#11379)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmajor committed Apr 29, 2024
1 parent eb7e32c commit 0397fcb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/six-boats-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte": patch
---

fix: require whitespace after `@const` tag
2 changes: 1 addition & 1 deletion packages/svelte/src/compiler/phases/1-parse/state/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ function special(parser) {
}

if (parser.eat('const')) {
parser.allow_whitespace();
parser.require_whitespace();

const id = read_pattern(parser);
parser.allow_whitespace();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { test } from '../../test';

export default test({
error: {
code: 'expected_whitespace',
message: 'Expected whitespace',
position: [19, 19]
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{#if true}
{@constfoo = 'bar'}
{/if}

0 comments on commit 0397fcb

Please sign in to comment.