1import { describe } from "@effect/vitest";
2
3import { createOxlintRuleHarness } from "../test/utils.ts";
4
5const rule = createOxlintRuleHarness("t3code/no-sparkles-icon", {
6 filename: "apps/web/src/components/chat/Example.tsx",
7});
8
9describe("t3code/no-sparkles-icon", () => {
10 rule.valid(
11 "allows icons that name the action",
12 `
13 import { BotIcon, ShieldCheckIcon } from "lucide-react";
14 import IconRobot from "@tabler/icons-react-native/IconRobot";
15
16 const icon = <SymbolView name={{ ios: "puzzlepiece", android: "extension" }} />;
17 `,
18 );
19
20 rule.valid(
21 "allows copy and identifiers that mention sparkles",
22 `
23 const NIGHTLY_SPARKLES = [];
24 const label = "Add some sparkles to the release notes";
25 `,
26 );
27
28 rule.invalid("reports Lucide sparkles icons", `import { SparklesIcon } from "lucide-react";`);
29
30 rule.invalid(
31 "reports every Lucide sparkle variant",
32 `import { Sparkle, WandSparklesIcon, LucideSparkles } from "lucide-react";`,
33 );
34
35 rule.invalid("reports Lucide icon nodes", `import { Sparkles } from "lucide";`);
36
37 rule.invalid(
38 "reports Tabler sparkles deep imports",
39 `import IconSparkles from "@tabler/icons-react-native/IconSparkles";`,
40 );
41
42 rule.invalid("reports SF Symbol sparkles names", `const icon = <SymbolView name="sparkles" />;`);
43
44 rule.invalid(
45 "reports platform symbol objects",
46 `const icon = { ios: "wand.and.sparkles", android: "auto_awesome" };`,
47 );
48});