archivo del paquete→ .shtukbase/packages/shtukbase-ui-html/checks/format.ts
checks/format.ts
17 líneas, 796 B.
El archivo tal como está en el paquete: el código y sus comentarios no se traducen.
- // SUI-R01. Every component file follows section 4 of the design build contract: the header (id, title, level,
- // description, states, the control schema), a <template> per state and status, the root with data-slot and class = id.
- import { scan } from '../lib/components.ts';
- export const RULE = { id: 'sui-r01', title: 'A component file has a valid header and a template for each state' };
- export function check(root = process.cwd()): string[] {
- const comps = scan(root);
- if (!comps.length) return ['design/shtukbase-ui-html/components: no components found (reinstall the package)'];
- return comps.flatMap((c) => c.problems.map((p) => `${c.html}: ${p}`));
- }
- if (import.meta.main) {
- const out = check();
- for (const l of out) console.log(l);
- process.exitCode = out.length ? 1 : 0;
- }