Repository navigation
Remove unused exports & dead code (using Knip) - #56817
Merged
Jake Bailey (jakebailey) merged 30 commits intoJun 27, 2024
Merged
Conversation
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #56818
When running Knip with a bit of config (see
knip.jsonc) I get these results:There are a few false positives, but I think the results are still quite useful.
Then I ran
npx knip --fixto remove theexportkeywords for unused exports, and then I went into the file to check it and remove the remaining dead code. Running the tests does not give issues.Let me know if I should remove Knip + config itself again, I totally understand you might not be eager to introduce new dependencies. Alternatively, I'm happy to extend the work until it reports no issues and then you can keep using this (in CI) it to prevent future regressions.