Version: eslint-plugin-svelte@3.11.0
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.:
const getNextPage = () => {
const newUrl = new URL(page.url) // !!! This leads to an error
newUrl.pathname = page.url.pathname
newUrl.searchParams.set('p', (pageNum + 1).toString())
return newUrl.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.