Skip to content

Conversation

@fvictorio
Copy link
Member

@fvictorio fvictorio commented Nov 8, 2025

This PR adds knip, a tool to find unused code. I've used in a couple of projects and it works quite well.

The most important thing to review here are the files I'm adding to the ignore* fields in the knip.json config. I'm erring on the side of not deleting things, since I don't know whether they are used or not.

I also added npm run knip to the lint script. Knip is quite fast, so this shouldn't make that script much slower. But if you think this is annoying, we can change that and only run it in the CI.

I'm creating this PR on top of #1296, since that's the last big refactor.

@fvictorio fvictorio requested a review from Janther November 8, 2025 10:30
"ignoreFiles": [
"tests/format/RespectDefaultOptions/respect-default-options.js",
"tests/integration/node.test.js"
],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference between ignore and ignoreFiles is not super obvious:

  • ignore means "don't report unused code inside this file".
  • ignoreFiles means "don't report the whole file as unused"

Base automatically changed from skip-variants to main November 8, 2025 11:03
@Janther Janther merged commit ef42205 into main Nov 8, 2025
7 checks passed
@Janther Janther deleted the knip branch November 8, 2025 13:15
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.

3 participants