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 calling the function \`fetch_data\` inside an $effect. Please check if the function is reassigning a stateful variable because that's considered malpractice and check if it could use \`$derived\` instead. Ignore this suggestion if you are sure this function is not assigning any stateful variable or if you can't check if it does.`,
149
+
);
150
+
});
151
+
152
+
it('should add a suggestion when calling a function inside an effect (with non identifier callee)',()=>{
`You are calling a function inside an $effect. Please check if the function is reassigning a stateful variable because that's considered malpractice and check if it could use \`$derived\` instead. Ignore this suggestion if you are sure this function is not assigning any stateful variable or if you can't check if it does.`,
{ state, path, next }: Context<Node|AST.SvelteNode,AutofixerState>,
65
+
){
66
+
run_if_in_effect(path,state,()=>{
67
+
constfunction_name=
68
+
node.callee.type==='Identifier' ? `the function \`${node.callee.name}\`` : 'a function';
69
+
state.output.suggestions.push(
70
+
`You are calling ${function_name} inside an $effect. Please check if the function is reassigning a stateful variable because that's considered malpractice and check if it could use \`$derived\` instead. Ignore this suggestion if you are sure this function is not assigning any stateful variable or if you can't check if it does.`,
0 commit comments