mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 13:36:48 +00:00
c83fa66c67
Nothing looked for dead code: no knip, depcheck or ts-prune, noUnusedLocals off. knip.jsonc configures knip over the client, server and shared workspaces with their real entry points (main.tsx, index.ts and bootstrap, the MikroORM config, the forked plugin host and its SDK surface, migrations and seeders found by glob, the shared build entries with one per locale, the scripts, the tests and the Playwright launcher). lint:knip (scripts/ci/knip-ratchet.mjs) counts its findings per category and file against scripts/ci/knip-baseline.json, which only shrinks and is built on the client's ratchet helpers. Today's 427 findings are frozen, among them unused server dependencies (nodemon, @types/uuid, eslint-plugin-prettier, @mikro-orm/cli), the unused root unrun, and imports of packages no package.json lists (leaflet.markercluster, geojson). False positives are fixed in knip.jsonc with the reason. knip is a root devDependency; the check runs in server-quality, the job that installs every workspace, and knip.jsonc joins the code area of the change classifier.
28 lines
1.4 KiB
JavaScript
28 lines
1.4 KiB
JavaScript
#!/usr/bin/env node
|
|
/*
|
|
* lint:knip: unused files, exports, types and dependencies may only go down.
|
|
*
|
|
* knip (configured in knip.jsonc at the repo root) follows the imports of the
|
|
* client, server and shared workspaces from their entry points and reports
|
|
* what nothing reaches: a file, an export, a type, a dependency in a
|
|
* package.json, an import of a package no package.json lists. Dead code
|
|
* costs every sweep that edits it and every reader who wonders who calls it.
|
|
* The findings per category and file are held in scripts/ci/knip-baseline.json:
|
|
* a file may not gain one, and an entry above what knip finds now, or for a
|
|
* file that is gone, fails until --update lowers it. A false positive (a
|
|
* file loaded by path, a public API surface) is fixed in knip.jsonc, with the
|
|
* reason, never by raising the baseline.
|
|
*
|
|
* npm run lint:knip check against the baseline (CI)
|
|
* npm run lint:knip -- --update lower the baseline to today's findings;
|
|
* it never raises an entry
|
|
*
|
|
* The comparison lives in scripts/ci/lib/knip.mjs.
|
|
*/
|
|
import { fileURLToPath } from 'node:url';
|
|
import { runCli } from '../../client/scripts/lib/ratchet.mjs';
|
|
import { check } from './lib/knip.mjs';
|
|
|
|
const root = fileURLToPath(new URL('../..', import.meta.url));
|
|
await runCli('lint:knip', (args) => check({ root, update: args.includes('--update') }));
|