Skip to content

chore(knip): 6.16 + rootDirs patch (fixes ./$types, refs webpro-nl/knip#1778)#46

Closed
PetalCat wants to merge 2 commits into
migrate/slidefrom
chore/knip-6.15
Closed

chore(knip): 6.16 + rootDirs patch (fixes ./$types, refs webpro-nl/knip#1778)#46
PetalCat wants to merge 2 commits into
migrate/slidefrom
chore/knip-6.15

Conversation

@PetalCat

@PetalCat PetalCat commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Updates knip to 6.16 and re-adds the rootDirs resolution that 6.15 dropped, so SvelteKit ./$types resolves again.

Why: knip 6.15 (e190a9fe) removed the rootDirs workaround (4dc16cc9, for #1628), assuming oxc-resolver 11.20 covered it — it does not for the SvelteKit-monorepo shape, so ./$types regressed. 6.16 kept the gap. Upstream issue: webpro-nl/knip#1778.

This PR:

  • catalog knip ^6.14.2 → ^6.16.0 (gets 6.16's upstream workspace-scoped paths)
  • re-adds per-workspace rootDirs resolution as patches/knip@6.16.0.patch (adapted to 6.16's scope-tagged dist — scopedRootDirs mirror of scopedPaths across ProjectPrincipal / graph/build / util/load-tsconfig / typescript/resolve-module-names)

Verified (node:26): pnpm install clean; pnpm lint:knip and lint:knip:prod both exit 0 — 0 ./$types unresolved, no $lib false-positives.

Replaces the old hand-rolled patches/knip.patch (was on 6.14.2). 🤖 Generated with Claude Code

@PetalCat PetalCat force-pushed the chore/knip-6.15 branch 2 times, most recently from 0db4020 to e5ce013 Compare June 5, 2026 23:20
@PetalCat PetalCat changed the title chore(knip): drop local patch, update to knip 6.15 chore(knip): drop local patch, update to knip 6.16 Jun 5, 2026
@PetalCat

PetalCat commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Do not merge — this regresses ./$types resolution.

Verified before/after (normal knip):

  • OLD (patch + 6.14.2): exit 0, ./$types resolves
  • 6.16 (no patch): exit 1, 33 ./$types unresolved

Root cause: ./$types resolves via tsconfig rootDirs (.svelte-kit/types). Our patches/knip.patch scopes both paths and rootDirs per workspace; upstream 574a088a (knip 6.16) only scoped paths. So 6.16 fixes the $lib false-positives but loses ./$types. Our patch is strictly more complete than upstream.

Next: rebase the rootDirs-scoping half onto 6.16 (so we get 6.16 + working ./$types) and upstream that diff to webpro-nl/knip — it's a genuine gap. Holding as draft.

@PetalCat PetalCat marked this pull request as draft June 5, 2026 23:24
@PetalCat

PetalCat commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Correction to my earlier comment — the root-cause analysis above was wrong. I compared patch+6.14 vs nopatch+6.16 and never tested nopatch+6.14. Per @lishaduck, 6.14 without the patch resolves ./$types fine — so this is an UPSTREAM knip regression introduced in 6.15 (the patch merely masks it), NOT something our patch's rootDirs-scoping uniquely fixes. Investigating the exact 6.15 commit + least-surface fix (config if possible) before deciding what to do with this PR. Still: do not merge as-is.

@PetalCat PetalCat changed the title chore(knip): drop local patch, update to knip 6.16 chore(knip): 6.16 + rootDirs patch (fixes ./$types, refs #1778) Jun 5, 2026
@lishaduck lishaduck changed the title chore(knip): 6.16 + rootDirs patch (fixes ./$types, refs #1778) chore(knip): 6.16 + rootDirs patch (fixes ./$types, refs webpro-no/knip#1778) Jun 5, 2026
@lishaduck lishaduck changed the title chore(knip): 6.16 + rootDirs patch (fixes ./$types, refs webpro-no/knip#1778) chore(knip): 6.16 + rootDirs patch (fixes ./$types, refs webpro-nl/knip#1778) Jun 5, 2026
Janet and others added 2 commits June 5, 2026 18:49
Catalog knip ^6.14.2 -> ^6.16.0 and drop the old 6.14.2 patch. On its own this
REPRODUCES webpro-nl/knip#1778: `pnpm lint:knip` reports 33 unresolved ./$types
imports across the SvelteKit apps (knip 6.15's e190a9fe removed the rootDirs
resolution workaround). The fix follows in the next commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…/$types)

Adds patches/knip@6.16.0.patch restoring the rootDirs resolution knip 6.15 dropped,
adapted to 6.16's scope-tagged dist (scopedRootDirs mirrors scopedPaths across
ProjectPrincipal / graph/build / util/load-tsconfig / typescript/resolve-module-names).

Verified node:26: pnpm install clean; `pnpm lint:knip` and `lint:knip:prod` both exit 0,
0 ./$types unresolved. Reverses the regression shown in the previous commit. Upstream #1778.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@returnsvoidjanet

Copy link
Copy Markdown
Contributor

Superseded by #49 (knip 6.16.1), which resolves the SvelteKit ./$types issue via the upstream fix — no manual rootDirs patch needed. Closing. (Note: the older base migrate/slide here also predates the knip-patch removal on main.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants