Closed
Description
Motivation
The motivation is basically similar to #675 - when doing internal navigation, you almost always want to prepend the base path. However, unlike goto
, links can also be used for external navigation. To navigate this complicated issue, I propose to only check relative links (at least by default).
Description
Add a rule that would trigger on any link 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";
</script>
<!-- ✓ GOOD -->
<a href={base + "/foo"}>Text</a>
<a href={`${base}/foo`}>Text</a>
<a href={whatever + "/foo"}>Text</a>
<a href={`${whatever}/foo`}>Text</a>
<a href="https://absolute.url">Text</a>
<!-- ✗ BAD -->
<a href={"/foo"}>Text</a>
<a href={"/foo" + base}>Text</a>
<a href={`foo/${base}`}>Text</a>
</svelte>
Additional comments
Based on #679 (comment)