pull/11327/head
Rich Harris 2 years ago
parent 3f93f4fd26
commit 785c675c89

@ -1,11 +0,0 @@
## derived_iife
> Use `$derived.by(() => {...})` instead of `$derived((() => {...})())`
## non_state_reference
> `%name%` is updated, but is not declared with `$state(...)`. Changing its value will not correctly trigger updates
## store_with_rune_name
> 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

@ -1,7 +1,15 @@
## derived_iife
> Use `$derived.by(() => {...})` instead of `$derived((() => {...})())`
## export_let_unused
> Component has unused export property '%name%'. If it is for external reference only, please consider using `export const %name%`
## non_reactive_update
> `%name%` is updated, but is not declared with `$state(...)`. Changing its value will not correctly trigger updates
## perf_avoid_inline_class
> Avoid 'new class' — instead, declare the class at the top level scope
@ -17,3 +25,7 @@
## reactive_declaration_module_script
> All dependencies of the reactive declaration are declared in a module script and will not be reactive
## store_rune_conflict
> 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

@ -320,7 +320,7 @@ export function analyze_component(root, source, options) {
} else if (declaration !== null && Runes.includes(/** @type {any} */ (name))) {
for (const { node, path } of references) {
if (path.at(-1)?.type === 'CallExpression') {
w.store_with_rune_name(node, store_name);
w.store_rune_conflict(node, store_name);
}
}
}
@ -524,7 +524,7 @@ export function analyze_component(root, source, options) {
type === 'AwaitBlock' ||
type === 'KeyBlock'
) {
w.non_state_reference(binding.node, name);
w.non_reactive_update(binding.node, name);
continue outer;
}
}
@ -532,7 +532,7 @@ export function analyze_component(root, source, options) {
}
}
w.non_state_reference(binding.node, name);
w.non_reactive_update(binding.node, name);
continue outer;
}
}

@ -479,30 +479,21 @@ export function derived_iife(node) {
}
/**
* `%name%` is updated, but is not declared with `$state(...)`. Changing its value will not correctly trigger updates
* @param {null | NodeLike} node
* @param {string} name
*/
export function non_state_reference(node, name) {
w(node, "non_state_reference", `\`${name}\` is updated, but is not declared with \`$state(...)\`. Changing its value will not correctly trigger updates`);
}
/**
* 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
* Component has unused export property '%name%'. If it is for external reference only, please consider using `export const %name%`
* @param {null | NodeLike} node
* @param {string} name
*/
export function store_with_rune_name(node, name) {
w(node, "store_with_rune_name", `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`);
export function export_let_unused(node, name) {
w(node, "export_let_unused", `Component has unused export property '${name}'. If it is for external reference only, please consider using \`export const ${name}\``);
}
/**
* Component has unused export property '%name%'. If it is for external reference only, please consider using `export const %name%`
* `%name%` is updated, but is not declared with `$state(...)`. Changing its value will not correctly trigger updates
* @param {null | NodeLike} node
* @param {string} name
*/
export function export_let_unused(node, name) {
w(node, "export_let_unused", `Component has unused export property '${name}'. If it is for external reference only, please consider using \`export const ${name}\``);
export function non_reactive_update(node, name) {
w(node, "non_reactive_update", `\`${name}\` is updated, but is not declared with \`$state(...)\`. Changing its value will not correctly trigger updates`);
}
/**
@ -537,6 +528,15 @@ export function reactive_declaration_module_script(node) {
w(node, "reactive_declaration_module_script", "All dependencies of the reactive declaration are declared in a module script and will not be reactive");
}
/**
* 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 {null | NodeLike} node
* @param {string} name
*/
export function store_rune_conflict(node, name) {
w(node, "store_rune_conflict", `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`);
}
/**
* The rest operator (...) will create a new object and binding '%name%' with the original object will not work
* @param {null | NodeLike} node

@ -1,6 +1,6 @@
[
{
"code": "non_state_reference",
"code": "non_reactive_update",
"message": "`does_need1` is updated, but is not declared with `$state(...)`. Changing its value will not correctly trigger updates",
"start": {
"column": 5,

@ -1,6 +1,6 @@
[
{
"code": "non_state_reference",
"code": "non_reactive_update",
"message": "`b` is updated, but is not declared with `$state(...)`. Changing its value will not correctly trigger updates",
"start": {
"column": 5,
@ -12,7 +12,7 @@
}
},
{
"code": "non_state_reference",
"code": "non_reactive_update",
"message": "`c` is updated, but is not declared with `$state(...)`. Changing its value will not correctly trigger updates",
"start": {
"column": 5,

@ -1,6 +1,6 @@
[
{
"code": "store_with_rune_name",
"code": "store_rune_conflict",
"message": "It looks like you're using the `$state` rune, but there is a local binding called `state`. Referencing a local variable with a `$` prefix will create a store subscription. Please rename `state` to avoid the ambiguity",
"start": {
"column": 1,

Loading…
Cancel
Save