Fixed knip and removed unused dependencies it surfaced - #29496
Conversation
no ref - knip.json: disabled vitest config auto-discovery at the root workspace. Knip's vitest plugin was naively dynamically importing every file matched by the root vitest.config.mjs's `test.projects` glob (packages/**, apps/*, used by the real vitest CLI for its unified watcher) as if each were itself a vitest config — including README.md files and packages/i18n/generate-context.js, whose un-awaited async IIFE threw an unhandled rejection that crashed the whole `knip` process before any report was produced. Each package already has its own correctly-scoped vitest.config.ts that knip reads directly, so the root config's broad glob was never needed for knip's analysis. - Removed 6 dependencies knip flagged as unused after verifying via full-repo grep that they have zero references anywhere: @tryghost/string and mingo (admin-x-settings, plus a stale @tryghost/string type declaration), @tryghost/kg-clean-basic-html and @tryghost/kg-markdown-html-renderer (ghost/core), lodash (kg-converters), @lexical/code (kg-lexical-html-renderer). - Pinned 6 more in ignoreDependencies since they're used through means knip's static analysis can't trace: bookshelf-relations is resolved by string name inside bookshelf's plugin API, kg-unsplash-selector is only referenced via a Tailwind @source CSS directive, and @tryghost/debug/@vitejs/plugin-react/vite-plugin-svgr are dynamically imported inside the shared apps/_shared/vite-public-app.mjs, whose vite.config knip previously couldn't even load.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
💤 Files with no reviewable changes (4)
WalkthroughUpdated dependency manifests for admin settings, Ghost core, and Koenig packages. Removed the Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run ghost:test:ci:integration |
✅ Succeeded | 3m 5s | View ↗ |
nx run-many -t test:unit -p @tryghost/admin-x-s... |
✅ Succeeded | 28s | View ↗ |
nx run ghost:test:integration |
✅ Succeeded | 3m 10s | View ↗ |
nx run @tryghost/admin:test:acceptance |
✅ Succeeded | 6m 1s | View ↗ |
nx run ghost:test:legacy |
✅ Succeeded | 3m 11s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 20s | View ↗ |
nx run @tryghost/koenig-lexical:test:acceptance |
✅ Succeeded | 2m 24s | View ↗ |
nx run-many -t lint -p @tryghost/admin-x-settin... |
✅ Succeeded | 3m 7s | View ↗ |
Additional runs (8) |
✅ Succeeded | ... | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-07-21 17:28:57 UTC
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #29496 +/- ##
==========================================
- Coverage 74.60% 74.59% -0.01%
==========================================
Files 1604 1604
Lines 140899 140903 +4
Branches 17212 17204 -8
==========================================
- Hits 105111 105109 -2
- Misses 34729 34760 +31
+ Partials 1059 1034 -25
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

Why
knip (added in #27716) was crashing before it could produce a report at all —
pnpm knipdied with an uncaughtENOENTfrom insidepackages/i18n/generate-context.js, a codegen script it had no business executing. With the tool actually broken, its first batch of real advisories (unused dependencies) had never been triaged.What
Fixed the crash. The root
vitest.config.mjs'stest.projectsglob (packages/**,apps/*, used by the realvitestCLI for its unified watcher) was being naively expanded by knip's vitest plugin, which dynamicallyimport()ed every matched file as if each were itself a vitest config — including README.md files andpackages/i18n/generate-context.js(whose un-awaited async IIFE threw an unhandled rejection that killed the whole process). Disabled knip's vitest config auto-discovery at the root workspace; every package already has its own correctly-scopedvitest.config.tsthat knip reads directly.Removed 6 genuinely dead dependencies knip flagged, each verified via full-repo grep to have zero references anywhere:
@tryghost/string,mingo(admin-x-settings) — also removed a stale@tryghost/stringtype declaration@tryghost/kg-clean-basic-html,@tryghost/kg-markdown-html-renderer(ghost/core)lodash(kg-converters)@lexical/code(kg-lexical-html-renderer)Pinned 6 more in
ignoreDependenciessince they're used through means knip's static analysis can't trace, and would otherwise get flagged as false positives on every future run:bookshelf-relations— resolved by string name inside bookshelf's.plugin()API, not a static import@tryghost/kg-unsplash-selector(admin) — only referenced via a Tailwind@sourceCSS directive@tryghost/debug,@vitejs/plugin-react,vite-plugin-svgr(5 public apps) — dynamically imported inside the sharedapps/_shared/vite-public-app.mjs, whosevite.configknip previously couldn't even loadVerification
pnpm knipnow runs to completion and produces a full report (previously crashed)pnpm build— all 32 projects build successfullyChecklist