Skip to content

Your app looks AI-generated. Vincent Van Gogh noticed. An agent skill that finds and fixes AI-looking UI and UX in mobile apps, web apps, and websites.

fix(detect): flag Primer SparkleFillIcon and SparklesFillIcon (#312)

Shreeyasshb2751d090e02
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index dec4610..ce36cd9 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1048,7 +1048,7 @@ const rules = [
// when the literal is exactly that symbol; substrings and apostrophes
// inside longer text stay quiet.
const symbol = /^(?:sparkles?(?:\.[a-z0-9._-]+)?|wand\.and\.(?:stars|sparkles)(?:\.[a-z0-9._-]+)?|[a-z0-9-]+:sparkles?|i-[a-z0-9-]+-sparkles?|wand-magic-sparkles)$/;
- const re = /\bauto_awesome\b|\bAutoAwesome(?:Outlined|Rounded|Sharp|TwoTone)?(?:Icon)?\b|\bSparkles\b|\bSparklesIcon\b|\bSparkle\b|\bSparkleIcon\b|\bIconSparkles\b|\bWandSparkles\b|\bWandSparklesIcon\b|✨|\b(?:Hi(?:Outline|Mini)?|Lu|Tb|Pi|Bs|Io|Ri)Sparkles?(?:Fill|Line|Outline|Sharp|Bold|Duotone|Light|Thin)?\b|\bRiSparkling(?:2)?(?:Fill|Line)?\b|\bMd(?:Outline|Round|Sharp|TwoTone)?AutoAwesome\b|\bfa(?:WandMagic)?Sparkles\b|(?<![\w-])fa-(?:wand-magic-)?sparkles(?![\w-])|(?<![\w-])ri-sparkling(?:-2)?-(?:line|fill)(?![\w-])|\bBsStars\b|(?<![\w-])bi-stars(?![\w-])/;
+ const re = /\bauto_awesome\b|\bAutoAwesome(?:Outlined|Rounded|Sharp|TwoTone)?(?:Icon)?\b|\bSparkles\b|\bSparklesIcon\b|\bSparkle\b|\bSparkleIcon\b|\bSparkles?FillIcon\b|\bIconSparkles\b|\bWandSparkles\b|\bWandSparklesIcon\b|✨|\b(?:Hi(?:Outline|Mini)?|Lu|Tb|Pi|Bs|Io|Ri)Sparkles?(?:Fill|Line|Outline|Sharp|Bold|Duotone|Light|Thin)?\b|\bRiSparkling(?:2)?(?:Fill|Line)?\b|\bMd(?:Outline|Round|Sharp|TwoTone)?AutoAwesome\b|\bfa(?:WandMagic)?Sparkles\b|(?<![\w-])fa-(?:wand-magic-)?sparkles(?![\w-])|(?<![\w-])ri-sparkling(?:-2)?-(?:line|fill)(?![\w-])|\bBsStars\b|(?<![\w-])bi-stars(?![\w-])/;
const hits = [...matches(re, code)].map((m) => m.index);
for (const literal of stringLiterals(code, stack)) {
diff --git a/test/detect.test.js b/test/detect.test.js
index 1141b8b..db98dc2 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -2986,3 +2986,26 @@ test("glow-shadow flags Flutter text Shadow(color: ...), not neutral ones (issue
assert.deepStrictEqual(glowLines("const s = Shadow(color: Color(0x42000000));\n"), []);
assert.deepStrictEqual(glowLines("const s = BoxShadow(color: Colors.black54, blurRadius: 4);\n"), []);
});
+
+test("sparkle-icon catches Primer SparkleFillIcon and SparklesFillIcon (issue #302)", () => {
+ const sparkleLines = (src, file = "Button.tsx") =>
+ scanSource(src, file).filter((f) => f.rule === "sparkle-icon").map((f) => f.line);
+
+ const repro = [
+ 'import { SparkleFillIcon, SparklesFillIcon, SparkleIcon, StarFillIcon } from "@primer/octicons-react";',
+ "export const a = <SparkleFillIcon />;",
+ "export const b = <SparklesFillIcon />;",
+ "export const c = <SparkleIcon />;",
+ "export const d = <StarFillIcon />;",
+ "export const e = <SparkleFillIconButton />;",
+ ].join("\n");
+ assert.deepStrictEqual(sparkleLines(repro), [1, 2, 3, 4]);
+
+ const ask = [
+ 'import { SparkleFillIcon, SparklesFillIcon } from "@primer/octicons-react";',
+ "",
+ "export const Ask = () => <button><SparkleFillIcon /> Ask</button>;",
+ "export const Summarize = () => <button><SparklesFillIcon /> Summarize</button>;",
+ ].join("\n");
+ assert.deepStrictEqual(sparkleLines(ask, "Ask.tsx"), [1, 3, 4]);
+});