mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 13:36:48 +00:00
ead327be73
The check only looked at src/ and tests/, so a new spec under e2e/ or a new script under scripts/ could land unformatted, and the ratchet scripts themselves did (fixed in the previous commit). It now walks e2e/ and scripts/ too and takes .mjs alongside .ts, .tsx and .css. The 58 files there that were unformatted before this branch (the e2e specs and help guides, the older build and lint scripts) join the baseline, which keeps only shrinking; JSON baselines stay out of scope.
29 lines
1.3 KiB
JavaScript
29 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
/*
|
|
* lint:format: new code is formatted with Prettier.
|
|
*
|
|
* Client code was never Prettier-checked, and almost every file differs from
|
|
* what .prettierrc asks for. Formatting all of it at once would bury the
|
|
* history under one commit, so the files that were unformatted when this
|
|
* check came in are listed in scripts/format-baseline.json and the list only
|
|
* shrinks: every file outside it, a new one in particular, must be formatted,
|
|
* and a listed file leaves the list once it has been formatted. The check
|
|
* covers .ts, .tsx, .mjs and .css under src/, tests/, e2e/ and scripts/.
|
|
*
|
|
* npm run lint:format check against the baseline (CI)
|
|
* npm run lint:format -- --list print every unformatted file
|
|
* npm run lint:format -- --update take formatted and deleted files off the list;
|
|
* it never adds one
|
|
*
|
|
* To format a file: npx prettier --write <file>. The comparison lives in
|
|
* scripts/lib/format.mjs.
|
|
*/
|
|
import { fileURLToPath } from 'node:url';
|
|
import { check } from './lib/format.mjs';
|
|
import { runCli } from './lib/ratchet.mjs';
|
|
|
|
const root = fileURLToPath(new URL('..', import.meta.url));
|
|
await runCli('lint:format', (args) =>
|
|
check({ root, update: args.includes('--update'), list: args.includes('--list') })
|
|
);
|