TypeScript
ci: enforce unused runtime exports in the web app (#10228)
Julius Marmingeda2ba5b81f8b
diff --git a/docs/operations/development.md b/docs/operations/development.mdindex 8016a777b22..e07758caa65 100644--- a/docs/operations/development.md+++ b/docs/operations/development.md@@ -72,10 +72,13 @@ Windows investigation while that suite is not a required gate.### Unused code`vp run knip:check` checks unused files and dependencies across the repo, then-unused runtime exports in every internal package under `packages/`. CI enforces both checks.+unused runtime exports in `apps/web` and every internal package under `packages/`.+CI enforces both checks.Exported types and Effect schemas are allowed without consumers. The schema preprocessorrecognizes schema types, including aliases and schema classes; functions that create or decodeschemas remain checked. Completely unused files remain checked too.+Named exports in web UI component modules are kept as complete component sets. Knip ignores+unused exports in `apps/web/src/components/ui/*.tsx`, while still reporting an entire unused file.Use `vp run knip --workspace apps/web` to audit one workspace, including exports,or `vp run knip:production --workspace apps/web` to find code kept alive only by tests.The full export audit still has findings and is not a repo-wide CI gate. Extend thediff --git a/knip.jsonc b/knip.jsoncindex aa665d09602..c6ba319da5b 100644--- a/knip.jsonc+++ b/knip.jsonc@@ -43,6 +43,10 @@"apps/web": {// Worktree setup invokes this directly from t3.json."entry": ["scripts/warm-dep-cache.ts"],+ // UI component modules are copied and adapted as cohesive sets. Keep their+ // named subcomponents even before they have callers; the file audit still+ // reports an entire component module when nothing imports it.+ "ignoreIssues": { "src/components/ui/*.tsx": ["exports", "nsExports", "duplicates"] },},"apps/mobile": {// Expo loads local config plugins by string; Metro handles platform variants.diff --git a/package.json b/package.jsonindex 5e72b463a10..4e5aca36d13 100644--- a/package.json+++ b/package.json@@ -26,7 +26,7 @@"tc": "vp run -r --concurrency-limit 2 typecheck","lint": "vp lint --report-unused-disable-directives","knip": "knip --preprocessor ./scripts/knip-schemas.ts",- "knip:check": "knip --include files,dependencies --no-config-hints && knip --workspace packages/client-runtime --workspace packages/contracts --workspace packages/effect-acp --workspace packages/effect-codex-app-server --workspace packages/shared --workspace packages/ssh --workspace packages/tailscale --exports --preprocessor ./scripts/knip-schemas.ts --no-config-hints",+ "knip:check": "knip --include files,dependencies --no-config-hints && knip --workspace apps/web --workspace packages/client-runtime --workspace packages/contracts --workspace packages/effect-acp --workspace packages/effect-codex-app-server --workspace packages/shared --workspace packages/ssh --workspace packages/tailscale --exports --preprocessor ./scripts/knip-schemas.ts --no-config-hints","knip:production": "knip --production --preprocessor ./scripts/knip-schemas.ts","lint:mobile": "node scripts/mobile-native-static-check.ts","test": "vp run -r test",