Issue 445
tech-debt: Find unused files, exports and packages with knip, in CI
Back to our planDone
citoolingtech-debtpriority: high
Summary
Add knip, a widely used open-source tool that finds files, exports and packages nothing uses anymore, and run it in CI so dead code can't pile up while #163 moves the site onto shared components.
Summary of the owner's request (2026-10-26, Claude Code session): if something important should be plugged in now, while the project is young, stop all current work, file a few GitHub issues or an epic, and plug in everything that suits the context and the project's aims and will pay off both soon and over time.
Details
- Native first: ESLint's
no-unused-varsonly sees one file, and TypeScript doesn't report unused exports. knip is the established tool for this (knip.dev, opens in a new tab); it reads Next.js, Vitest, ESLint and Payload's config files through its plugins. - Dev dependency only; check it against the package rules in
docs/guidelines/security.md. - Start with a
knip.json: entries forsrc/app,src/payload.config.ts, the seed,intelligence/; ignore generated files (src/payload-types.ts,src/migrations/,src/app/(payload)/). - First run: remove what is really dead, or list why it stays.
- Add
npm run knipand a CI job. Start it as a non-required check; make it required once main is clean.
Acceptance criteria
- Not done:
npm run knippasses on main with no unexplained ignores. - Not done: A CI job runs it on every PR.
- Not done:
docs/project.md(Tests, Known Gotchas) and thewrite-codeskill mention it.
Generated by Claude Code, opens in a new tab