Skip to content

chore: introduce knip & some initial housekeeping#12154

Draft
webpro wants to merge 4 commits intosanity-io:mainfrom
webpro:chore/introduce-knip
Draft

chore: introduce knip & some initial housekeeping#12154
webpro wants to merge 4 commits intosanity-io:mainfrom
webpro:chore/introduce-knip

Conversation

@webpro
Copy link

@webpro webpro commented Feb 13, 2026

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.jsonc configuration file has a few comments re. exceptions but is otherwise fairly common, I'd say. Note that the packages/@sanity/cli workspace 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-files

What to review

  • Regular QA such as lint, type-check and (e2e) tests.
  • Scan the list of removed files for any false positives or otherwise helpful files we should not delete.

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!

@vercel
Copy link

vercel bot commented Feb 13, 2026

@webpro is attempting to deploy a commit to the Sanity Sandbox Team on Vercel.

A member of the Team first needs to authorize it.

@webpro webpro changed the title Introduce knip chore: introduce knip & some initial housekeeping Feb 13, 2026
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.

1 participant