Files
TREK/client/scripts/strict-lint.mjs
T
Maurice 83d807781e ci(client): hold strict null check errors per file to a baseline that only shrinks
The client compiles with strict: false, so nullable contract fields arrive as
if always present and implicit anys stay invisible. tsconfig.strict.json is the
same program with strictNullChecks and noImplicitAny, and lint:strict
(scripts/strict-lint.mjs) counts its errors per file against
scripts/strict-baseline.json: a file may not gain one, a new file has to be
clean, and an entry above its count fails until --update lowers it. Nothing is
converted here; today's 534 errors in 165 files are frozen. allowJs stays: the
tests import the .mjs scripts and read their JSDoc types through it.
The todo MSW handler maps a cleared priority to its default so the test
helper written in this branch starts at zero. The check runs after the
typecheck in client-quality.
2026-10-10 21:32:59 +02:00

31 lines
1.5 KiB
JavaScript

#!/usr/bin/env node
/*
* lint:strict: the errors strict null checks would raise may only go down.
*
* The client compiles with strict: false, so a `.nullable()` field from
* @trek/shared arrives as if it were always there and an untyped parameter is
* an `any` nobody sees. Turning strict on at once would mean fixing hundreds
* of files in one go. Instead tsconfig.strict.json is the same program with
* strictNullChecks and noImplicitAny on, and this counts its errors per file
* against scripts/strict-baseline.json: a file may not gain one, and a file
* without an entry, which every new file is, has to be clean. An entry above
* its count, or for a file that is gone, fails until --update lowers it, so a
* file brought down stays down. When a whole directory reaches zero, it can
* move into the main tsconfig's strict settings for good.
*
* npm run lint:strict check against the baseline (CI)
* npm run lint:strict -- --list print every error, file by file
* npm run lint:strict -- --update lower the baseline to today's counts;
* it never raises an entry
*
* The parsing and the comparison live in scripts/lib/strict.mjs.
*/
import { fileURLToPath } from 'node:url';
import { runCli } from './lib/ratchet.mjs';
import { check } from './lib/strict.mjs';
const root = fileURLToPath(new URL('..', import.meta.url));
await runCli('lint:strict', (args) =>
check({ root, update: args.includes('--update'), list: args.includes('--list') })
);