-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add Knip with initial config #20572
Add Knip with initial config #20572
Conversation
@webpro thanks for bringing this my my attention, and thank you for the detailed explanation of knip in the meeting. I don't see knip being used anywhere? no CI config change, and also no documentation on how to run things manually. We chatted about integrating it into the check script that each of our packages have. How do you propose we move this PR forwards? |
That's what we still need to discuss here. Gave a few example commands to run it manually and get a feel for what Knip does (docs: https://github.com/webpro/knip). Depending on the project needs and goals there are a few ways to go about getting this PR merged. Since I think most (if not all) of the workspaces/packages are not without issues according to Knip, I would advice to decide on some focus areas first and then gradually work towards a situation which the maintainers are happy about. Questions:
Notes:
This is possible indeed. It requires a knip config in each of those packages. Added an example just now in the |
Oh I forgot to mention: when running
Quickly got into TS config issues when separating this and didn't want to introduce more changes into this PR at this point. |
@webpro eventually I'd like to move the scripts to run out of the |
@webpro I'll keep knip in mind, and will come back to it later. Thank you for your time, energy and expertise working on this PR. |
Of course, Norbert. Let me know if/when I can help. Best of luck! |
Knip is a tool to find unused files, dependencies and exports. There are multiple ways to use it, and in the Storybook repo, for starters, it could be a great companion for clean ups and refactorings.
This PR contains Knip with some initial configuration to get started. Analysis can be done for the project as a whole, or per workspace. Also, output can be filtered for specific issue types. A few example commands to get an idea:
Please refer to the Knip docs for more details.
The Storybook project would benefit from a programmatic API and/or dynamic configuration (e.g.
knip.ts
instead ofknip.json
). For instance, to read the entry files from thepackage.json#bundler.entries
in many workspaces and merge into the Knip config. Both are on Knip's roadmap.Please let me know if you have any questions or feedback regarding Knip or this PR specifically.
Let's get this collaboration started and find out how we can help each other while improving DX for everyone :)