-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking: warn/error on old syntax in runes mode (#11203)
* breaking: warn/error on old syntax in runes mode - warn on slots and event handlers in runes mode - error on `<slot>` + `{@render ...}` tag usage in same component closes #9416 * render tag + slot could occur in legacy mode as well, error there, too
- Loading branch information
1 parent
4ef6454
commit d51075c
Showing
11 changed files
with
106 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"svelte": patch | ||
--- | ||
|
||
breaking: warn on slots and event handlers in runes mode, error on `<slot>` + `{@render ...}` tag usage in same component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/svelte/tests/compiler-errors/samples/slot-conflicting-with-render-tag/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
error: { | ||
code: 'conflicting-slot-usage', | ||
message: | ||
'Cannot use <slot> syntax and {@render ...} tags in the same component. Migrate towards {@render ...} tags completely.', | ||
position: [71, 84] | ||
} | ||
}); |
6 changes: 6 additions & 0 deletions
6
packages/svelte/tests/compiler-errors/samples/slot-conflicting-with-render-tag/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<script> | ||
let { children } = $props(); | ||
</script> | ||
|
||
{@render children()} | ||
<slot></slot> |
13 changes: 13 additions & 0 deletions
13
packages/svelte/tests/validator/samples/runes-legacy-syntax-warnings/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script> | ||
let { foo } = $props(); | ||
</script> | ||
|
||
<!-- ok --> | ||
<button onclick={foo}>click me</button> | ||
<Button onclick={foo}>click me</Button> | ||
<Button on:click={foo}>click me</Button> | ||
|
||
<!-- warn --> | ||
<slot></slot> | ||
<slot name="foo"></slot> | ||
<button on:click={foo}>click me</button> |
38 changes: 38 additions & 0 deletions
38
packages/svelte/tests/validator/samples/runes-legacy-syntax-warnings/warnings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[ | ||
{ | ||
"code": "deprecated-slot-element", | ||
"end": { | ||
"column": 13, | ||
"line": 11 | ||
}, | ||
"message": "Using <slot> to render parent content is deprecated. Use {@render ...} tags instead.", | ||
"start": { | ||
"column": 0, | ||
"line": 11 | ||
} | ||
}, | ||
{ | ||
"code": "deprecated-slot-element", | ||
"end": { | ||
"column": 24, | ||
"line": 12 | ||
}, | ||
"message": "Using <slot> to render parent content is deprecated. Use {@render ...} tags instead.", | ||
"start": { | ||
"column": 0, | ||
"line": 12 | ||
} | ||
}, | ||
{ | ||
"code": "deprecated-event-handler", | ||
"end": { | ||
"column": 22, | ||
"line": 13 | ||
}, | ||
"message": "Using on:click to listen to the click event is is deprecated. Use the event attribute onclick instead.", | ||
"start": { | ||
"column": 8, | ||
"line": 13 | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters