You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them.`,
126
+
);
127
+
});
128
+
129
+
it(`should add suggestions when using .${method}() on a stateful variable with an array init`,()=>{
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them.`,
141
+
);
142
+
});
143
+
144
+
it(`should add suggestions when using .${method}() on a stateful variable with conditional if it's not sure if the method could actually be present on the variable ($state({}))`,()=>{
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them. However I can't verify if "count" is a state variable of an object or a class with a "${method}" method on it. Please verify that before updating the code to use a normal assignment`,
156
+
);
157
+
});
158
+
159
+
it(`should add suggestions when using .${method}() on a stateful variable with conditional if it's not sure if the method could actually be present on the variable ($state(new Class()))`,()=>{
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them. However I can't verify if "count" is a state variable of an object or a class with a "${method}" method on it. Please verify that before updating the code to use a normal assignment`,
171
+
);
172
+
});
173
+
174
+
it(`should add suggestions when using .${method}() on a stateful variable with conditional if it's not sure if the method could actually be present on the variable ($state(variable_name))`,()=>{
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them. However I can't verify if "count" is a state variable of an object or a class with a "${method}" method on it. Please verify that before updating the code to use a normal assignment`,
187
+
);
188
+
});
189
+
190
+
it(`should not add suggestions when using .${method} on a stateful variable if it's not a method call`,()=>{
191
+
constcontent=run_autofixers_on_code(`
192
+
<script>
193
+
const count = $state({});
194
+
function update_count() {
195
+
console.log(count.${method});
196
+
}
197
+
</script>`);
198
+
199
+
expect(content.suggestions).not.toContain(
200
+
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them. However I can't verify if "count" is a state variable of an object or a class with a "${method}" method on it. Please verify that before updating the code to use a normal assignment`,
`You are importing "${rune}" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$${rune}" directly.`,
220
+
);
221
+
});
222
+
223
+
it(`should add suggestions when importing "${rune}" as the default export from '${source}'`,()=>{
`You are importing "${rune}" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$${rune}" directly.`,
232
+
);
233
+
});
234
+
235
+
it(`should add suggestions when importing '${rune}' as the namespace export from '${source}'`,()=>{
`You are importing "${rune}" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$${rune}" directly.`,
244
+
);
245
+
});
246
+
});
247
+
248
+
it(`should add suggestions when importing multiple runes from '${source}'`,()=>{
249
+
constcontent=run_autofixers_on_code(`
250
+
<script>
251
+
import { onMount, state, effect } from '${source}';
`You are importing "state" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$state" directly.`,
257
+
);
258
+
expect(content.suggestions).toContain(
259
+
`You are importing "effect" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$effect" directly.`,
260
+
);
261
+
});
262
+
263
+
it(`should not add suggestions when importing other identifiers from '${source}'`,()=>{
264
+
constcontent=run_autofixers_on_code(`
265
+
<script>
266
+
import { onMount } from '${source}';
267
+
</script>`);
268
+
269
+
expect(content.suggestions).not.toContain(
270
+
`You are importing "onMount" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$onMount" directly.`,
271
+
);
272
+
});
273
+
},
274
+
);
275
+
});
276
+
277
+
describe('derived_with_function',()=>{
278
+
it(`should add suggestions when using a function as the first argument to $derived`,()=>{
0 commit comments