Skip to content

Commit 84a34ae

Browse files
committed
lint
1 parent 1070039 commit 84a34ae

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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 destructured array pattern and the state expression must be an identifier.
173+
> `$state.opaque(...)` must be declared with an destructured array pattern and the state expression and invalidation expression must be an identifier.
174174
175175
For example: `let [state, invalidate] = $state.opaque(data);`
176176

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ export function CallExpression(node, context) {
9898
(parent.type !== 'VariableDeclarator' ||
9999
parent.id.type !== 'ArrayPattern' ||
100100
parent.id.elements.length !== 2 ||
101-
parent.id.elements[0]?.type !== 'Identifier')
101+
parent.id.elements[0]?.type !== 'Identifier' ||
102+
parent.id.elements[1]?.type !== 'Identifier')
102103
) {
103104
e.state_invalid_opaque_declaration(node);
104105
}

0 commit comments

Comments
 (0)