import { fileURLToPath } from "node:url"; import { ESLint } from "eslint"; import { describe, expect, it } from "vitest"; // `local/literal-a11y-text` (eslint.config.js): what a screen reader or a tooltip says is user-facing // text, so it goes through t() like the rest. Five English `aria-label`s and a whole English panel // survived every lane before it. A rule that matches nothing looks exactly like a clean codebase, so // this asserts it fires. const RULE = "local/literal-a11y-text"; const FRONTEND = fileURLToPath(new URL("../../", import.meta.url)); async function hits(source: string): Promise { const eslint = new ESLint({ cwd: FRONTEND }); const [result] = await eslint.lintText(source, { filePath: "src/components/__probe.tsx" }); return (result?.messages ?? []).filter((m) => m.ruleId === RULE).length; } describe("a literal word in an attribute the user hears or sees", () => { it("is refused, in every spelling of a string", async () => { expect(await hits(`export const A = () =>