Skip to content

Commit f01a15f

Browse files
committed
more correct error code - it's the state that isn't mutated, not the rune
1 parent 57e1c08 commit f01a15f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export function analyze_module(ast, options) {
218218
for (const [, scope] of scopes) {
219219
for (const [name, binding] of scope.declarations) {
220220
if (binding.kind === 'state' && !binding.mutated) {
221-
warn(warnings, binding.node, [], 'state-rune-not-mutated', name);
221+
warn(warnings, binding.node, [], 'state-not-mutated', name);
222222
}
223223
}
224224
}
@@ -377,7 +377,7 @@ export function analyze_component(root, options) {
377377
for (const [, scope] of instance.scopes) {
378378
for (const [name, binding] of scope.declarations) {
379379
if (binding.kind === 'state' && !binding.mutated) {
380-
warn(warnings, binding.node, [], 'state-rune-not-mutated', name);
380+
warn(warnings, binding.node, [], 'state-not-mutated', name);
381381
}
382382
}
383383
}

packages/svelte/src/compiler/warnings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const runes = {
2222
`It looks like you're using the $${name} rune, but there is a local binding called ${name}. ` +
2323
`Referencing a local variable with a $ prefix will create a store subscription. Please rename ${name} to avoid the ambiguity.`,
2424
/** @param {string} name */
25-
'state-rune-not-mutated': (name) =>
25+
'state-not-mutated': (name) =>
2626
`${name} is declared with $state(...) but is never updated. Did you mean to create a function that changes its value?`,
2727
/** @param {string} name */
2828
'non-state-reference': (name) =>

0 commit comments

Comments
 (0)