Migrate content hrefs to SvelteKit resolve() (deferred from #101) #111

Open
opened 2026-07-19 17:20:26 +00:00 by manlycucumber · 0 comments

Deferred from #101 (eslint-plugin-svelte v3). The v3 rule svelte/no-navigation-without-resolve is currently off because a naive migration breaks Bosco's routing contract. If we ever want the rule back on, this is what a correct migration must handle:

The tension. Bosco sets trailingSlash: 'always' (src/routes/+layout.ts) and every content href ends in / (the static build emits dir/index.html; guard:offline asserts trailing-slash hrefs). SvelteKit's resolve('/route/[p]', {p}) builds paths from the route id and emits them without a trailing slash. So a blind migration would strip the slash from every link and break both guard:offline and the live host's dir/ contract.

What a real migration needs:

  1. Decide the trailing-slash story: either wrap as `${resolve(...)}/` (verify the rule accepts it) or revisit trailingSlash.
  2. The ~11 route-id-shaped links (library/[category], library/[category]/[topic], field-guide/habitat/[habitat], field-guide/kind/[kind]) can use resolve() with params.
  3. SearchPanel's href={hit.url} is an opaque Pagefind index URL — not a route id — so it can't use resolve(); keep it with a scoped disable or a dedicated helper.
  4. base is permanently '' (apex-hosted; remark-bosco hardcodes it) so there is no functional bug today — this is code-hygiene/idiom, not a correctness fix. Low priority.
  5. Verify end-to-end (e2e + a real deploy smoke) that no-JS navigation and direct hits still resolve to /x/ before shipping.
Deferred from #101 (eslint-plugin-svelte v3). The v3 rule `svelte/no-navigation-without-resolve` is currently **off** because a naive migration breaks Bosco's routing contract. If we ever want the rule back on, this is what a correct migration must handle: **The tension.** Bosco sets `trailingSlash: 'always'` (src/routes/+layout.ts) and every content href ends in `/` (the static build emits `dir/index.html`; `guard:offline` asserts trailing-slash hrefs). SvelteKit's `resolve('/route/[p]', {p})` builds paths from the route id and emits them **without** a trailing slash. So a blind migration would strip the slash from every link and break both guard:offline and the live host's dir/ contract. **What a real migration needs:** 1. Decide the trailing-slash story: either wrap as `` `${resolve(...)}/` `` (verify the rule accepts it) or revisit `trailingSlash`. 2. The ~11 route-id-shaped links (library/[category], library/[category]/[topic], field-guide/habitat/[habitat], field-guide/kind/[kind]) can use `resolve()` with params. 3. `SearchPanel`'s `href={hit.url}` is an **opaque Pagefind index URL** — not a route id — so it can't use `resolve()`; keep it with a scoped disable or a dedicated helper. 4. `base` is permanently `''` (apex-hosted; remark-bosco hardcodes it) so there is **no functional bug today** — this is code-hygiene/idiom, not a correctness fix. Low priority. 5. Verify end-to-end (e2e + a real deploy smoke) that no-JS navigation and direct hits still resolve to `/x/` before shipping.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Bosco/bosco#111
No description provided.