Files
Maurice bd267c67f8 ci(client): fail the count ratchets on an entry above the tree
lint:size, lint:layers, lint:rtl (both baselines), lint:skips and
lint:warnings only failed a count that passed its entry. A count that
fell below its entry was logged and nothing more, so a file that shrank
could grow back to its old entry unseen, and the entry of a deleted
file stayed behind for the next file at that path. lint:format and
lint:offline already fail on such a stale entry, and the docs said
these counts may only shrink.

Each of them now fails on an entry that lowerCounts would lower or
drop, naming its count or saying the file is gone, and tells to run
--update, which still only lowers. staleCounts and reportStale in
lib/ratchet.mjs hold the shared part. Every baseline matches the tree
today, so none needed lowering. The client CLAUDE.md says so, and that
CI lints through lint:warnings rather than lint:check.
2026-10-08 14:11:54 +02:00

29 lines
1.5 KiB
JavaScript

#!/usr/bin/env node
/*
* lint:warnings: ESLint warnings may only go down.
*
* Most rules in eslint.config.mjs are warnings, set that way to keep CI green
* on code that was never linted, and a warning never fails a build. So they
* piled up: unused variables hiding dead props, missing effect dependencies
* of the kind that has already shown stale money. This runs ESLint over the
* client and counts the warnings per rule, separately for app code and
* tests, and the messages an eslint-disable comment silenced as a third
* group. Each count may not pass its entry in scripts/eslint-baseline.json,
* and an entry above its count fails as well until --update lowers it, so a
* fixed warning cannot come back unseen.
* Any error fails as well, so the check can stand in for `npm run lint:check`,
* and so does a block comment that configures a rule inline (such as one that
* turns no-explicit-any off): it leaves no message to count, so it would
* otherwise be the free way past the ratchet.
*
* npm run lint:warnings check against the baseline (CI)
* npm run lint:warnings -- --update lower the baseline to today's counts;
* it never raises an entry
*/
import { fileURLToPath } from 'node:url';
import { check } from './lib/eslint-warnings.mjs';
import { runCli } from './lib/ratchet.mjs';
const root = fileURLToPath(new URL('..', import.meta.url));
await runCli('lint:warnings', (args) => check({ root, update: args.includes('--update') }));