remove state-not-mutated warning, which is no longer valid

proxied-state-each-blocks
Rich Harris 9 months ago committed by Dominic Gannaway
parent c59b3011e4
commit 6d151ce444

@ -215,15 +215,6 @@ export function analyze_module(ast, options) {
merge(set_scope(scopes), validation_runes_js, runes_scope_js_tweaker)
);
// If we are in runes mode, then check for possible misuses of state runes
for (const [, scope] of scopes) {
for (const [name, binding] of scope.declarations) {
if (binding.kind === 'state' && !binding.mutated) {
warn(warnings, binding.node, [], 'state-not-mutated', name);
}
}
}
return {
module: { ast, scope, scopes },
name: options.filename || 'module',
@ -376,15 +367,6 @@ export function analyze_component(root, options) {
merge(set_scope(scopes), validation_runes, runes_scope_tweaker, common_visitors)
);
}
// If we are in runes mode, then check for possible misuses of state runes
for (const [, scope] of instance.scopes) {
for (const [name, binding] of scope.declarations) {
if (binding.kind === 'state' && !binding.mutated) {
warn(warnings, binding.node, [], 'state-not-mutated', name);
}
}
}
} else {
instance.scope.declare(b.id('$$props'), 'prop', 'synthetic');
instance.scope.declare(b.id('$$restProps'), 'rest_prop', 'synthetic');

@ -22,9 +22,6 @@ const runes = {
`It looks like you're using the $${name} rune, but there is a local binding called ${name}. ` +
`Referencing a local variable with a $ prefix will create a store subscription. Please rename ${name} to avoid the ambiguity.`,
/** @param {string} name */
'state-not-mutated': (name) =>
`${name} is declared with $state(...) but is never updated. Did you mean to create a function that changes its value?`,
/** @param {string} name */
'non-state-reference': (name) =>
`${name} is updated, but is not declared with $state(...). Changing its value will not correctly trigger updates.`
};

@ -1,3 +0,0 @@
import { test } from '../../test';
export default test({});

@ -1,10 +0,0 @@
<script>
function createCounter() {
let count = $state(0);
return {
get count() {
return count
}
};
}
</script>

@ -1,14 +0,0 @@
[
{
"code": "state-not-mutated",
"end": {
"column": 11,
"line": 3
},
"message": "count is declared with $state(...) but is never updated. Did you mean to create a function that changes its value?",
"start": {
"column": 6,
"line": 3
}
}
]
Loading…
Cancel
Save