chore: introduce knip & some initial housekeeping#12154
Draft
webpro wants to merge 4 commits intosanity-io:mainfrom
Draft
chore: introduce knip & some initial housekeeping#12154webpro wants to merge 4 commits intosanity-io:mainfrom
webpro wants to merge 4 commits intosanity-io:mainfrom
Conversation
|
@webpro is attempting to deploy a commit to the Sanity Sandbox Team on Vercel. A member of the Team first needs to authorize it. |
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.
Description
Hello, e18e here 👋 Coming from sanity-io/next-sanity#3261 and a quick chat with @bjoerge.
This pull request introduces Knip, and some initial configuration and housekeeping.
Knip can find and fix unused files, exports and dependencies. Main focus here is "inbox zero" for unused files, as the rest will follow from that (some related reading: https://knip.dev/guides/handling-issues).
Initial configuration was largely generated by the Knip MCP Server in VS Code extension (https://knip.dev/reference/integrations). Such tooling could be used moving forward to let coding agents help us out to clean up and tweak config.
The
knip.jsoncconfiguration file has a few comments re. exceptions but is otherwise fairly common, I'd say. Note that thepackages/@sanity/cliworkspace is explicitly excluded, as I understood the CLI package will be moved into a separate repo soon. Excluded workspaces can be added to analysis, but for now to me this seems like a reasonable cut-off.The dependency updates have been done by the coding agent, the file deletions were done using
pnpm knip --fix-type files --allow-remove-filesWhat to review
Notes for release
The PR currently has a preview release of Knip. Can update to GA before we merge.
Future work
Plenty of opportunities for more housekeeping (files, exports, dependencies), and not only with Knip. We might want to dig deeper while keeping things automated using remove-unused-vars and unbarrelify as well.
We might want to consider opportunities in additional areas too:
Just let us know and we can coordinate further steps together!