mirror of https://github.com/sveltejs/svelte
Merge 8dea7d1c52 into cd8d40af1a
commit
28cae76c60
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': minor
|
||||
---
|
||||
|
||||
feat: add warning for non-updated bindable
|
||||
@ -0,0 +1,12 @@
|
||||
<script>
|
||||
let {
|
||||
foo = $bindable(),
|
||||
bar = $bindable(),
|
||||
baz = $bindable()
|
||||
} = $props();
|
||||
|
||||
bar = 'new value';
|
||||
baz.nested = 'value';
|
||||
</script>
|
||||
|
||||
<p>{foo} {bar} {baz.nested}</p>
|
||||
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"code": "bindable_prop_not_mutated",
|
||||
"end": {
|
||||
"column": 5,
|
||||
"line": 3
|
||||
},
|
||||
"message": "`foo` is declared with `$bindable()` but is not mutated or reassigned",
|
||||
"start": {
|
||||
"column": 2,
|
||||
"line": 3
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
// svelte-ignore bindable_prop_not_mutated
|
||||
let { foo = $bindable() } = $props();
|
||||
</script>
|
||||
|
||||
<p>{foo}</p>
|
||||
Loading…
Reference in new issue