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
The svelte/prefer-svelte-reactivity rule currently triggers even inside regular functions where Svelte's reactivity is not needed or doesn't make sense.
e.g.:
constgetNextPage=()=>{constnewUrl=newURL(page.url)// !!! This leads to an errornewUrl.pathname=page.url.pathnamenewUrl.searchParams.set('p',(pageNum+1).toString())returnnewUrl.toString()}
In this context:
new URL(...) is a straightforward operation.
There's no reactive dependency tracking needed.
Restructuring this logic into a reactive statement (e.g., using SvelteURL()) would be unnecessary.
I would also expect the reactive version to be slower than the native one.
I've encountered similar false positives with other built-ins like Date and Set.
patoi, micheal-parks, kyle-leonhard and samausirmarekdedic