import { describe, expect, it } from "vitest"; import { eslint } from "./lintProbe.testkit"; // `local/input-primitive` (eslint.config.js): every text field is ui/Input, Textarea or InnerInput and // every checkbox / slider / colour well a NativeControls primitive (docs/DESIGN.md A4, A6; E28 S3c). // ~100 hand-styled boxes were swept; this pins that the rule keeping a new one out fires, and where it // stands down. const RULE = "local/input-primitive"; async function hits(source: string, filePath = "src/components/__probe.tsx"): Promise { const [result] = await eslint.lintText(source, { filePath }); return (result?.messages ?? []).filter((m) => m.ruleId === RULE).length; } describe("a hand-rolled field", () => { it("is refused anywhere outside the field primitives, text box or native control", async () => { const text = 'export const A = () => ;\n'; expect(await hits(text)).toBe(1); expect(await hits(text, "src/design-lab/__probe.tsx")).toBe(1); // …and in a ui/ composite: the pager's page box is an Input too. expect(await hits(text, "src/components/ui/Pager.tsx")).toBe(1); expect(await hits("export const B = () =>