Clean up unused and misplaced dependencies flagged by knip - #4394
Merged
Conversation
Remove genuinely-unused dependency declarations and relocate deps that were declared in a workspace that never imported them. Also fix two knip config gaps that were producing false positives. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
📊 Performance Test ResultsComparing d6fce3e vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
bcotrim
approved these changes
Jul 30, 2026
bcotrim
left a comment
Contributor
There was a problem hiding this comment.
LGTM 👍
CI is green and I couldn't find any regressions
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.
Related issues
npx knipcleanupHow AI was used in this PR
Claude Code ran
npx knip, then cross-referenced every finding against actual imports across the whole monorepo to distinguish three cases: genuinely-unused deps, deps declared in the wrong workspace, and knip false positives. Each conclusion was verified withnpm why, a fullnpm run typecheck, and a re-run of knip. All findings and edits were reviewed by a human before opening this PR.Proposed Changes
npx knipreported ~38 unused dependencies, but most were not actually dead — they were declared in a workspace that never imports them (knip reports per-workspace, so a dep used only from a sibling package reads as "unused" where it's declared). This PR sorts every finding into the correct bucket:compression,compressible,strip-ansi,@wp-playground/common,@wordpress/html-entities,@wordpress/rich-text).http-proxy/tar/yauzl/fast-deep-equalinapps/studiothat belong toapps/cli/packages/common; theexpresstrio inapps/clialready present inapps/local/apps/hosted;patch-packageduplicated from root). These packages stay installed — they're still required elsewhere — so nothing changes at runtime.electron2appx→ root, used byscripts/;@types/yauzl→apps/cli).apps/studionow listselectron.vite.config.tsas an entry, andpackages/data-liberation-agentnow has anentryplus.tsxin its project glob.The result is that each workspace's
package.jsonaccurately declares what it imports, instead of relying on npm hoisting. The lockfile shrinks accordingly (onlycompression/compressibleand their private subtree are physically removed; everything else is dedup bookkeeping).Dev-tooling/manifest change only — no runtime or user-visible behavior changes.
A separate, pre-existing issue (knip's ~22 "unlisted" phantom dependencies — imported but declared nowhere, resolving via hoisting) is intentionally out of scope and will be handled in a follow-up.
Testing Instructions
npm install— completes cleanly, no peer-dependency conflicts (removes the now-unreferencedcompressionsubtree).npm run typecheck— passes across all six workspaces, confirming no removed/moved dep broke resolution.npx knip— the only remaining "unused" findings are the deliberately-kept ones (@sentry/reactvia VitemanualChunks,@wp-playground/clispawned as a binary,@automattic/wp-babel-makepotvianpxin a Fastfile, andhpagent/rehype-raw/@types/shell-quotewhich sit behind orphaned files being removed in Remove remaining unused files flagged by Knip #4393).Pre-merge Checklist