Skip to content

Commit 409bebc

Browse files
committed
lint
1 parent 9a8b448 commit 409bebc

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

documentation/docs/98-reference/.generated/compile-errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ Cannot export state from a module if it is reassigned. Either export a function
751751
### state_invalid_opaque_declaration
752752

753753
```
754-
`$state.opaque` must be declared with an array destructuring pattern (e.g. `let [state, invalidate] = $state.opaque(data);`)
754+
`%rune%(...)` must be declared with an array destructuring pattern (e.g. `let [state, invalidate] = $state.opaque(data);`)
755755
```
756756

757757
### state_invalid_placement

packages/svelte/messages/compile-errors/script.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ It's possible to export a snippet from a `<script module>` block, but only if it
170170
171171
## state_invalid_opaque_declaration
172172

173-
> `$state.opaque` must be declared with an array destructuring pattern (e.g. `let [state, invalidate] = $state.opaque(data);`)
173+
> `%rune%(...)` must be declared with an array destructuring pattern (e.g. `let [state, invalidate] = $state.opaque(data);`)
174174
175175
## state_invalid_placement
176176

packages/svelte/src/compiler/errors.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,13 @@ export function state_invalid_export(node) {
433433
}
434434

435435
/**
436-
* `$state.opaque` must be declared with an array destructuring pattern (e.g. `let [state, invalidate] = $state.opaque(data);`)
436+
* `%rune%(...)` must be declared with an array destructuring pattern (e.g. `let [state, invalidate] = $state.opaque(data);`)
437437
* @param {null | number | NodeLike} node
438+
* @param {string} rune
438439
* @returns {never}
439440
*/
440-
export function state_invalid_opaque_declaration(node) {
441-
e(node, "state_invalid_opaque_declaration", "`$state.opaque` must be declared with an array destructuring pattern (e.g. `let [state, invalidate] = $state.opaque(data);`)");
441+
export function state_invalid_opaque_declaration(node, rune) {
442+
e(node, "state_invalid_opaque_declaration", `\`${rune}(...)\` must be declared with an array destructuring pattern (e.g. \`let [state, invalidate] = $state.opaque(data);\`)`);
442443
}
443444

444445
/**

packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function CallExpression(node, context) {
100100
parent.id.elements.length !== 2 ||
101101
parent.id.elements[0]?.type !== 'Identifier')
102102
) {
103-
e.state_invalid_opaque_declaration(node);
103+
e.state_invalid_opaque_declaration(node, rune);
104104
}
105105

106106
break;

0 commit comments

Comments
 (0)