Closed
Description
Motivation
In SvelteKit, the goto
function is used for internal navigation. That means, that you basically almost always want to prefix the url with the base
path.
Description
Add a rule that would trigger on any goto
without a base
path. However, there are quite some edge cases
Examples
<script>
import { base } from "$app/paths";
import { base as whatever } from "$app/paths";
import { goto } from "$app/navigation";
<!-- ✓ GOOD -->
goto(base + "/foo");
goto(`${base}/foo`)
goto(whatever + "/foo");
goto(`${whatever}/foo`)
goto("https://absolute.url");
<!-- ✗ BAD -->
goto("/foo");
goto("foo/" + base);
goto(`foo/${base}`);
</svelte>
Additional comments
Is this plugin the right place to put SvelteKit rules?