New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: replace ts-prune with knip #174
feat: replace ts-prune with knip #174
Conversation
.eslintrc.cjs
Outdated
@@ -12,7 +12,7 @@ module.exports = { | |||
overrides: [ | |||
{ | |||
extends: ["plugin:markdown/recommended"], | |||
files: ["**/*.{md}"], | |||
files: ["**/*.md"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, nice catch. If you can pull this out into a separate PR I'd be happy to pull it in quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is probably what's causing https://github.com/JoshuaKGoldberg/template-typescript-node-package/actions/runs/3943867603/jobs/6749189690:
/home/runner/work/template-typescript-node-package/template-typescript-node-package/README.md
96:1 error Parsing error: ESLint was configured to run on `<tsconfigRootDir>/README.md/2_2.ts` using `parserOptions.project`: <tsconfigRootDir>/tsconfig.eslint.json
Should probably split this out into a separate issue & PR. I can take a look at this too if you don't have time. ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's convenient to leave it in this PR? Eventually it's caused by different backing glob parsers (in ESLint and Knip), but necessary for green lights in this PR.
Codecov Report
@@ Coverage Diff @@
## main #174 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 6 6
Branches 3 3
=========================================
Hits 6 6 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey again @webpro! Nice to see a tool getting worked on that can holistically tackle unused code/dependency detection. I'm up for trying it out! Especially since it's already spotted yargs
as an unnecessary dependency. 😄
But, a few blockers:
- There shouldn't be any false positives
- Let's get it running in CI with a GitHub Action
- You'll want to remove
ts-prune
in this PR too, since it'll now be redundant - The dependency on an explicit
esbuild
version
c8b891f
to
027b74e
Compare
Great, happy to hear you are interested!
Things are sorted out, except for the |
Just saw that Also enabled production mode:
If interested, read more at https://github.com/webpro/knip/tree/next#production-mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok this is looking great, thanks @webpro! I looked at this more closely and think this is the last list of things to request:
ts-prune
is still referenced in the README.md. It should be replaced with knip.- Would you like the honors of writing the marketing text for it? 😁
knip.jsonc
references thesetup/
directory. But the setup script removes that directory. The setup script should be augmented to changeknip.jsonc
to no longer referencesetup/
Do you have time to make these changes? Absolutely no worries if not, I should Soon ™️ 🙂
Done :)
The entry files reference the two
Sure, just pushed the changes. |
...sort of! In more detail: the repo contains a The setup script is also meant to remove the Does that all sound reasonable to you? (This repo is still new and I'm still learning how to document+explain it!) |
Ah, that makes sense. I've now actually ran the setup. You may want to remove the Ideally, the |
Another win for Knip! 😄 #193
Yes! |
Alright, I prefer to leave the rest of the project-specific things and scripts to you. Let's get this PR merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Nice! |
@allcontributors add @webpro for feature tooling |
I've put up a pull request to add @webpro! 🎉 |
Noticed the other day (from release-it/release-it#964) that this repo might benefit from Knip, so here I am introducing Knip to find unused files, dependencies and exports.
Docs: https://github.com/webpro/knip/blob/next/README.md. Knip v1 is almost out, this PR holds v1.0.0-beta.9 but the API shouldn't change anymore, so that should not affect this PR.
Some remarks for now:
vitest
andnpm-package-json-lint
yargs
is unused and can be removed?Would you be interested at all in having Knip in this repo? Happy to answer any questions or feedback you might have.
Fixes #192