Skip to content
Source
Sign inSign up
Open History to see the last commit

no-em-dash-copy.test.ts

25 lines815 Bytes

1import { describe } from "@effect/vitest";
2​
3import { createOxlintRuleHarness } from "../test/utils.ts";
4​
5const rule = createOxlintRuleHarness("t3code/no-em-dash-copy", {
6 filename: "apps/web/src/components/Example.tsx",
7});
8​
9describe("t3code/no-em-dash-copy", () => {
10 rule.valid(
11 "allows em dashes in comments and regex literals",
12 `
13 // Parses titles like "Issue — Browser".
14 const title = /^ [–—-] \\S/u;
15 `,
16 );
17​
18 rule.valid("allows hyphens and en dashes", `const label = "Refresh failed - retry 1–2";`);
19​
20 rule.invalid("reports a string literal", `const label = "Refresh failed — retry";`);
21​
22 rule.invalid("reports a template literal", "const label = `${name} — ${kind}`;");
23​
24 rule.invalid("reports JSX text", `const node = <p>Run a prompt — on an interval</p>;`);
25});