Skip to content

Commit d2c3e2e

Browse files
ci: reject unused files and dependencies with Knip (pingdotgg#9962)
1 parent 00d4618 commit d2c3e2e

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ jobs:
4545
- name: Ensure Electron runtime is installed
4646
run: vp run --filter @t3tools/desktop ensure:electron
4747

48+
# Export cleanup is still a manual audit; files and dependencies have no baseline.
49+
- name: Check unused files and dependencies
50+
run: vp run knip:check
51+
4852
- name: Check
4953
run: vp check
5054

‎docs/operations/development.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ Use `vp run lint:mobile` for native mobile changes. CI owns the full suite; see
6969
The [manual Windows lane](../../.github/workflows/windows-tests.yml) is available for focused
7070
Windows investigation while that suite is not a required gate.
7171

72+
### Unused code
73+
74+
`vp run knip:check` runs the unused-file and dependency check enforced by CI.
75+
Use `vp run knip --workspace apps/web` to audit one workspace, including exports,
76+
or `vp run knip:production --workspace apps/web` to find code kept alive only by tests.
77+
The full export audit still has findings and is not a CI gate. Review callers before
78+
deleting code; production mode can also report development scripts and test fixtures.
79+
Runtime-discovered entrypoints and dependency exceptions belong in [knip.jsonc](../../knip.jsonc).
80+
7281
## Desktop artifacts
7382

7483
Local artifact builds are unsigned by default and write to `release/`:

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"tc": "vp run -r --concurrency-limit 2 typecheck",
2727
"lint": "vp lint --report-unused-disable-directives",
2828
"knip": "knip",
29+
"knip:check": "knip --include files,dependencies --no-config-hints",
2930
"knip:production": "knip --production",
3031
"lint:mobile": "node scripts/mobile-native-static-check.ts",
3132
"test": "vp run -r test",

0 commit comments

Comments
 (0)