Repository navigation
chore: check for unused code with knip - #558
Merged
Merged
Conversation
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.
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.
Problem
Nothing reported unused files, exports or dependencies, and 19 module-private names were exported as if something relied on them.
Change
bun run lint:unusedand run it in the CI lint job; CONTRIBUTING lists it.knip.jsonignores 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.actionlintandzizmor --offlineonci.yml: clean.