chore: check import cycles and the ui barrel with knip - #10
Merged
morinokami merged 2 commits intoSep 24, 2026
Merged
Conversation
Two checks that knip ships but leaves off by default: - Circular imports. The issue type is opt-in and reported only as a warning, so `rules.cycles` makes it an error and the `knip` script runs a second, cycles-only pass (`knip --cycles`). Listing `cycles` in `include` would do it in one pass, but `include` replaces knip's default issue types, so a type added by a later knip would silently go unchecked. The second pass takes about two seconds. - Unused exports of @astro-devtools/ui's entry files. The package is private and bundled into astro-devtools, its only consumer, so a component that src/index.ts re-exports but no panel imports is dead code; `includeEntryExports` for that workspace now reports it. Both came out of evaluating fallow as a replacement for, or addition to, knip: of the findings fallow adds, these are the ones that matter in this repository, and knip covers them with configuration alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UqHXUSZPwCjuSarsmo14em
commit: |
package.json cannot carry a comment, and `knip && knip --cycles` does not explain itself: the second pass exists because naming `cycles` in knip.jsonc's `include` would replace knip's default issue types. Define the command as a `knip` task in the root vite.config.ts instead, with that reason beside it, and drop the script (a task and a script may not share a name). `vp run knip`, and with it CI and `vp run ready`, runs the same two passes. knip needs no `ignoreDependencies` entry for the task-only invocation, since it always treats its own package as used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UqHXUSZPwCjuSarsmo14em
morinokami
deleted the
claude/fallow-knip-replacement-investigation-5484pq
branch
September 24, 2026 13:17
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.
Two checks that knip ships but leaves off by default:
rules.cyclesmakes it an error and knip now runs a second, cycles-only pass (knip && knip --cycles). Listingcyclesinincludewould do it in one pass, butincludereplaces knip's default issue types, so a type added by a later knip would silently go unchecked. The second pass takes about two seconds.@astro-devtools/ui's entry files. The package is private and bundled into astro-devtools, its only consumer, so a component thatsrc/index.tsre-exports but no panel imports is dead code;includeEntryExportsforpackages/uinow reports it.The two-pass command moves from the
knipscript in package.json to akniptask in the rootvite.config.ts, where a comment beside it records why it runs twice (package.json cannot hold one; a task and a script may not share a name).vp run knipis unchanged, so CI andvp run readyrun both passes as before. knip needs noignoreDependenciesentry for the task-only invocation, since it always treats its own package as used.Why these two
They came out of evaluating fallow as a replacement for, or addition to, knip. Regressions injected into a copy of the repository showed what fallow catches beyond knip here: import cycles, unconsumed ui re-exports, and unused class members (there is one production class, the overlay's custom element). knip covers the first two with configuration alone, so a second analyzer with its own config and dependency is not worth it.
Verification
vp run -r build,vp run playground#sync,vp check,vp run knip,vp run publint.vp run knip(the task) fails on an injected import cycle and on an unused re-export inpackages/ui/src/index.ts, and passes again once both are reverted.export *re-exports) now fail the--cyclespass, and an unused re-export inpackages/ui/src/index.tsfails the first pass. Every other case gives the same result as before, and the unmodified tree passes.knip.jsonc, the rootvite.config.ts, andpackage.json's scripts.🤖 Generated with Claude Code
https://claude.ai/code/session_01UqHXUSZPwCjuSarsmo14em