chore: integrate knip for dead-code detection - #158
Merged
Conversation
Adds knip (unused files/dependencies/exports) to the toolchain, wired into `pnpm knip`, the "Before PRs" checklist, and CI's lint job. knip.jsonc carries per-workspace overrides for gaps its defaults can't infer on their own: multi-entry package `exports` subpaths (its package.json→dist→src source mapping needs a workspace tsconfig `outDir`, which conflicts with this repo's cross-workspace `src/*.ts` imports), nested Next.js/PostCSS roots, `storybook-solidjs-vite` not matching the Storybook plugin's trigger, UnoCSS config discovered by directory proximity rather than import, tsnapi's generated snapshot fixtures, and a handful of genuinely dynamic dependency references (runtime string-literal plugin loading, markdown code samples, transitive type-only leaks). Also cleans up what the baseline run surfaced: ~30 needlessly exported internal-only symbols demoted to file-local, a few fully dead files and code paths removed (plugins/git's unused ported UI components, an unused helper, two orphaned test constants), 8 stale dependencies dropped, and 4 real missing/phantom dependencies added. Co-authored-by: opencode <noreply@opencode.ai>
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
A `pnpm install` run during the knip integration work rewrote `pnpm-workspace.yaml`'s catalogs section and flattened the `*nuxt`/ `*storybook` anchor references (`refs:` block) into literal version strings, defeating their point — keeping `@nuxt/kit`, the `@storybook/*` family, and `storybook` itself in sync with one written version each. Restores those two, and also wires up the `&unocss`/`&vueuse` anchors (defined but never referenced) to `unocss`/`@unocss/*`/`@vueuse/core` in the `frontend` catalog, so all four `refs:` entries are load-bearing. No version values changed. Co-authored-by: opencode <noreply@opencode.ai>
antfubot
added a commit
that referenced
this pull request
Aug 3, 2026
Resolves conflicts from #158 (knip integration): - packages/hub/package.json: keep our @standard-schema/spec addition, take main's removal of the (knip-flagged unused) birpc dependency - pnpm-lock.yaml: regenerated via `pnpm install --lockfile-only` Also fixes two knip findings the merge exposed in this branch's own new surface (unchecked by knip before it landed on main): - instance-registry.ts: DEVFRAME_INSTANCES_DIR_ENV / DEVFRAME_DISABLE_INSTANCE_REGISTRY_ENV / resolveInstancesDir / probeDevframeInstance drop `export` — module-internal per the barrel's existing "read/probe/prune helpers stay internal" comment, nothing outside the file used them - packages/next: DevframeNextHostMcpOptions (the `mountMcp` options type) now re-exported from the package barrel, alongside its sibling option types — a real gap, not a knip false positive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds knip — unused files, dependencies, and exports — to the toolchain:
pnpm knipscript, wired into the "Before PRs" checklist and CI's lint job.Config
knip.jsonccarries per-workspace overrides for the handful of gaps knip's defaults can't infer on their own here, each documented inline:exportssubpaths (packages/devframe,packages/hub, the built-in plugins, …) — knip's package.json→dist→src source mapping needs a workspacetsconfig.jsonoutDir, but this repo's packages resolve each other'ssrc/*.tsdirectly across workspaces via thepathsaliases intsconfig.base.json, andoutDirbreakstsc'srootDirinference for every consumer that does. Entries are listed explicitly instead.src/clientrather than the workspace root (PostCSS config discovery).plugins/a11y'sstorybook-solidjs-viteframework, which doesn't match knip's Storybook plugin trigger (only@storybook/*scoped packages do).packages/json-render-ui's standalone SPA, whose UnoCSS config is discovered by directory proximity rather than an import.tsnapi's generated API-snapshot fixtures (compared byte-for-byte, never imported).next-devframe-hub), markdown code samples (docs), a transitive type-only leak from@nuxt/kit's own dependency graph.Cleanup
The baseline run also surfaced real findings, fixed directly:
exported internal-only symbols demoted to file-local.plugins/git's unused ported shadcn UI components (card.tsx/separator.tsx/tabs.tsx, per this repo's own "port on demand" convention), an unused helper, two orphaned test constants.@antfu/ni,tsdownat root;birpc,pathe,ws,h3, a few Radix/CVA leftovers) —pnpm-workspace.yaml'scleanupUnusedCatalogsauto-pruned the now-unreferenced catalog entries.pathe,@antfu/designat root;valibotin two examples;@vueuse/core,@standard-schema/spec).Verified with
pnpm lint && pnpm knip && pnpm test && pnpm typecheck && pnpm build— including thetsnapiAPI-snapshot suite, which would fail if any of theexportdemotions had touched real public API surface.This PR was created with the help of an agent.