chore: add an unused-dependency CI check (knip) (closes #42)#56
Merged
Conversation
Nothing caught dependencies declared but imported nowhere (this let @tanstack/react-query sit unused until #49). Add knip as a CI guardrail. - knip + knip.json, configured for the vinxi/TanStack Start entrypoints so there are zero false positives; tailwindcss allowlisted (used via the CSS @import + @tailwindcss/vite, which knip can't trace); drizzle plugin off so knip needn't execute drizzle.config.ts - `pnpm knip` script + an "Unused dependency check" CI step in ci.yml - Removed @testing-library/user-event — knip flagged it as genuinely unused - Scaffold now drops @hono/zod-validator (only the removed example route used it) so the propagated check passes out-of-box in a fresh instance - Documented in docs/agents/dependencies.md Verified: knip clean in the template and in a scaffolded instance; preflight green; instance preflight green. Closes #42.
…mple Reworks the example-route story so the unused-dependency check stays honest without scaffold quietly dropping a dependency. - Add `GET /api/health` (app/server/routes/health.ts), a dependency-free liveness route kept in scaffolded projects - Keep the request-validation example mounted by default (so @hono/zod-validator stays a *used* dependency); split its tests into example.test.ts - Add `scripts/remove-example.mjs` — opt-out that deletes the example route + test, unmounts it, and drops @hono/zod-validator (documented in api.md) - Scaffold no longer strips the server example or drops the dependency Verified end-to-end: template preflight + knip green; a scaffolded instance is knip-green with the example kept; running remove-example.mjs leaves a knip-green, preflight-green instance with only the health route.
Instead of dropping @testing-library/user-event for being unused, demonstrate it so it's a genuinely-used dependency. - Add an interactive `Counter` example component + `Counter.test.tsx` that simulates a real click with @testing-library/user-event - Switch tests/setup.ts to the Vitest-specific jest-dom entry (`@testing-library/jest-dom/vitest`) - Restores @testing-library/user-event to devDependencies Verified: knip green (user-event now used), preflight green (44 tests incl. the Counter click test); scaffolded instance keeps Counter + user-event, knip green.
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.
Closes #42. Draft for your review (
safe:human). Adds the unused-dependency guardrail, and — per our discussion — reworks the example-route and testing-example stories so the check stays honest without dropping anything useful.1. Unused-dependency check (the core of #42)
pnpm knip+ a CI step, configured inknip.jsonso false positives are zero (vinxi/TanStack Start entry points;tailwindcssallowlisted because it's used via the CSS@import+@tailwindcss/vite; drizzle plugin disabled so knip needn't executedrizzle.config.ts).docs/agents/dependencies.md.2.
@testing-library/user-event— kept and demonstratedknip originally flagged
user-eventas unused. Rather than drop it, this demonstrates it so it's genuinely used:Counterexample component +Counter.test.tsxthat simulates a real click withuser-event(render → click → assert).tests/setup.tsto the Vitest-specific jest-dom entry:@testing-library/jest-dom/vitest.3. Useful, removable example routes
Instead of scaffold deleting the example route and orphaning
@hono/zod-validator:GET /api/health(app/server/routes/health.ts) — a dependency-free liveness route, kept in scaffolded projects.@hono/zod-validatorstays a used dependency. Its tests moved toexample.test.ts.scripts/remove-example.mjs— opt-out that deletes the example route + test, unmounts it, and drops@hono/zod-validator. Documented indocs/agents/api.md.Verification (end-to-end)
pnpm preflightgreen (44 tests incl. the Counter click test),pnpm knipexit 0.@hono/zod-validatoranduser-eventpresent, knip exit 0, preflight pass.node scripts/remove-example.mjsin that instance: onlyhealthremains,@hono/zod-validatordropped,index.tscleanly mounts health (not example), knip still exit 0, preflight pass.🤖 Generated with Claude Code