Files
gstack/lib/design-lint/rules/copy.ts
T
garrytanandcapy-ai[bot] 1ba2ae0425 feat(design-lint): core of the bundled free design lint (parsers, colour, tokens, reporter, waivers, CLI)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-10-26 05:31:11 +00:00

27 lines
1.1 KiB
TypeScript

/**
* The copy tier: gstack-design-craft's content-realism and ship-floor tells
* (lib/design-craft.ts, Elaya-derived, MIT) under the lint's contract. The
* craft check counts occurrences without positions, so these report at the
* document's first line with the count as evidence until Phase 2 folds the
* patterns into the lint. Tells the static tier already reports with a line
* (transition: all under layout-transition, 100vh under vh-height) are left
* to it.
*/
import { checkCraft } from '../../design-craft';
import type { LintContext } from '../context';
import type { Reporter } from '../report';
import { ruleMeta } from './ids';
const STATIC_OWNS = new Set(['transition-all', 'vh-height']);
export function run(ctx: LintContext, r: Reporter): void {
for (const doc of ctx.docs) {
if (doc.kind !== 'html') continue;
for (const f of checkCraft(doc.raw)) {
if (STATIC_OWNS.has(f.id) || !ruleMeta(f.id)) continue;
const title = ruleMeta(f.id)!.title;
r.report(f.id, doc.file, 1, f.count === 1 ? title : `${title}, ${f.count} times`, { fix: f.fix, source: 'copy' });
}
}
}