mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
0344a86aec
The checker scripts were written without semicolons, against the semi: true in .prettierrc, so every one of them failed the formatting rule lint:format enforces on src/ and tests/. This is prettier --write over the scripts this branch added or rewrote, nothing else.
28 lines
1.3 KiB
JavaScript
28 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
/*
|
|
* lint:layers: imports follow the layering, downwards only.
|
|
*
|
|
* Components reached up into pages/ for models and helpers, and sideways into
|
|
* mobile/ for phone hooks and sheets, so nothing could be moved or split
|
|
* without touching three trees. scripts/lib/layers.mjs holds the rules: a
|
|
* component imports neither pages/ nor mobile/, a shared hook no view, and
|
|
* nothing under the views (stores, repos, sync, api, db, helpers) a view at
|
|
* all. The imports that already broke a rule are counted per file in
|
|
* scripts/layers-baseline.json, and a file may hold no more of them than its
|
|
* entry (a file without an entry holds none). Type-only imports count: a type
|
|
* the lower layer needs belongs below it.
|
|
*
|
|
* npm run lint:layers check against the baseline (CI)
|
|
* npm run lint:layers -- --list print every import against the layering
|
|
* npm run lint:layers -- --update lower the baseline to what the files hold now;
|
|
* it never raises an entry
|
|
*/
|
|
import { fileURLToPath } from 'node:url';
|
|
import { check } from './lib/layers.mjs';
|
|
import { runCli } from './lib/ratchet.mjs';
|
|
|
|
const root = fileURLToPath(new URL('..', import.meta.url));
|
|
await runCli('lint:layers', (args) =>
|
|
check({ root, update: args.includes('--update'), list: args.includes('--list') })
|
|
);
|