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). // ~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", () => { // Each new path's first lint makes the type-aware project service load it (0.4–1 s apiece, a repeat // ~0): this case lints three, ~1 s idle, past 5 s on a busy machine. it( "is refused anywhere outside the field primitives, text box or native control", { timeout: 30_000 }, 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 = () =>