ShtukbaseStandard
файл пакета→ .shtukbase/packages/shtukbase-ui-html/checks/format.ts

checks/format.ts

17 строк, 796 Б.

Файл как есть в пакете: код и комментарии в нём не переводятся.

  1. // SUI-R01. Every component file follows section 4 of the design build contract: the header (id, title, level,
  2. // description, states, the control schema), a <template> per state and status, the root with data-slot and class = id.
  3. import { scan } from '../lib/components.ts';
  4. export const RULE = { id: 'sui-r01', title: 'A component file has a valid header and a template for each state' };
  5. export function check(root = process.cwd()): string[] {
  6. const comps = scan(root);
  7. if (!comps.length) return ['design/shtukbase-ui-html/components: no components found (reinstall the package)'];
  8. return comps.flatMap((c) => c.problems.map((p) => `${c.html}: ${p}`));
  9. }
  10. if (import.meta.main) {
  11. const out = check();
  12. for (const l of out) console.log(l);
  13. process.exitCode = out.length ? 1 : 0;
  14. }