mirror of https://github.com/sveltejs/svelte
breaking: warn on quotes single-expression attributes in runes mode (#12479)
* parse `foo={bar}` attribute as `value: { type: 'ExpressionTag', .. }` (i.e. don't wrap in an array) * warn on quoted single-expression-attributes * breaking: warn on quotes single-expression attributes in runes mode In a future version, that will mean things are getting stringified, which is a departure from how things work today, therefore a warning first. Related to #7925 * Update .changeset/plenty-items-build.md * Apply suggestions from code review * missed a spot --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/12478/head
parent
b88e667b85
commit
32b55eaa93
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
breaking: warn on quoted single-expression attributes in runes mode
|
@ -0,0 +1,21 @@
|
|||||||
|
<svelte:options runes />
|
||||||
|
|
||||||
|
<!-- don't warn on these -->
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
<p class="{foo}"></p>
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
<svelte:element this={foo} class="{foo}"></svelte:element>
|
||||||
|
|
||||||
|
<!-- warn on these -->
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
<Component class="{foo}" />
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
<svelte:component this={foo} class="{foo}" />
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
{#if foo}
|
||||||
|
<svelte:self class="{foo}" />
|
||||||
|
{/if}
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
<custom-element class="{foo}"></custom-element>
|
@ -0,0 +1,50 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "attribute_quoted",
|
||||||
|
"message": "Quoted attributes on components and custom elements will be stringified in a future version of Svelte. If this isn't what you want, remove the quotes",
|
||||||
|
"start": {
|
||||||
|
"column": 11,
|
||||||
|
"line": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"column": 24,
|
||||||
|
"line": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "attribute_quoted",
|
||||||
|
"message": "Quoted attributes on components and custom elements will be stringified in a future version of Svelte. If this isn't what you want, remove the quotes",
|
||||||
|
"start": {
|
||||||
|
"column": 29,
|
||||||
|
"line": 15
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"column": 42,
|
||||||
|
"line": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "attribute_quoted",
|
||||||
|
"message": "Quoted attributes on components and custom elements will be stringified in a future version of Svelte. If this isn't what you want, remove the quotes",
|
||||||
|
"start": {
|
||||||
|
"column": 14,
|
||||||
|
"line": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"column": 27,
|
||||||
|
"line": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "attribute_quoted",
|
||||||
|
"message": "Quoted attributes on components and custom elements will be stringified in a future version of Svelte. If this isn't what you want, remove the quotes",
|
||||||
|
"start": {
|
||||||
|
"column": 16,
|
||||||
|
"line": 21
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"column": 29,
|
||||||
|
"line": 21
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in new issue