t3-code-android-nightly/oxlint-plugin-t3code/rules/no-em-dash-copy.test.ts
Theo Browne d7f3b72548
fix: no more em dashes in product copy (#23799)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 13:43:37 -07:00

25 lines
815 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { describe } from "@effect/vitest";
import { createOxlintRuleHarness } from "../test/utils.ts";
const rule = createOxlintRuleHarness("t3code/no-em-dash-copy", {
filename: "apps/web/src/components/Example.tsx",
});
describe("t3code/no-em-dash-copy", () => {
rule.valid(
"allows em dashes in comments and regex literals",
`
// Parses titles like "Issue — Browser".
const title = /^ [–—-] \\S/u;
`,
);
rule.valid("allows hyphens and en dashes", `const label = "Refresh failed - retry 1–2";`);
rule.invalid("reports a string literal", `const label = "Refresh failed — retry";`);
rule.invalid("reports a template literal", "const label = `${name} — ${kind}`;");
rule.invalid("reports JSX text", `const node = <p>Run a prompt — on an interval</p>;`);
});