Skip to content

chore: check for unused code with knip - #558

Merged
cevdetch merged 2 commits into
mainfrom
chore/knip
Nov 28, 2026
Merged

cevdetch merged 2 commits into
mainfrom
chore/knip

Conversation

@cevdetch

Copy link
Copy Markdown
Owner

Problem

Nothing reported unused files, exports or dependencies, and 19 module-private names were exported as if something relied on them.

Change

  • Stop exporting names used only inside their own module (corpus, scripts, site libs).
  • Add knip 6.49.0 as bun run lint:unused and run it in the CI lint job; CONTRIBUTING lists it.
  • knip.json ignores exports that are read where knip cannot look: rule logic modules (imported by the generated, Git-ignored registries), core's barrel, the rules type contract and the selector types. The bookmarklet source and the entities generator are entries; the rename fixture is ignored.

Verification

  • bun run lint:unused: exit 0, no configuration hints.
  • validate:rules && build && build:css && build:bookmarklet && typecheck && test && check:self && site:check && lint:deps: pass, 912 tests.
  • bun run check:site: SEO checks pass on 251 pages.
  • actionlint and zizmor --offline on ci.yml: clean.

Each of these is used only inside its own module; exporting them suggested a contract nothing relies on.
Add knip as lint:unused and run it in the CI lint job. Rule logic modules, core's barrel, the rules type contract and the selector types are read by the generated, Git-ignored registries or by adapters, so their exports are ignored; the bookmarklet source and the entities generator are entries.
@cevdetch
cevdetch merged commit 0194c1c into main Nov 28, 2026
8 checks passed
@cevdetch
cevdetch deleted the chore/knip branch November 28, 2026 15:20
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.

1 participant