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): catch Fluent UI's Sparkle icons in sparkle-icon (#334)

Pranav Arya22aa44c914f6
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index 019f47b..73f5509 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1062,7 +1062,8 @@ 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|\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-])/;
+ // Fluent UI names its sparkle SparkleRegular, SparkleFilled, or sized like Sparkle24Regular (#324).
+ 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-])|\bSparkle(?:\d{2})?(?:Regular|Filled)\b/;
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 6b7f32b..15fda3e 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -2328,6 +2328,34 @@ test("sparkle-icon flags Bootstrap Icons' BsStars and bi-stars, not the single r
assert.deepStrictEqual(sparkleLines('<i className="kbi-stars" />\n'), []);
});
+test("sparkle-icon flags Fluent UI's SparkleRegular, SparkleFilled and their sized names (issue #324)", () => {
+ const sparkleLines = (src, file = "Ask.tsx") => [...new Set(scanSource(src, file).filter((f) => f.rule === "sparkle-icon").map((f) => f.line))];
+ // Issue #324 repro:
+ const repro = [
+ 'import { Sparkle24Regular, Sparkle20Filled } from "@fluentui/react-icons";',
+ "",
+ "export const Ask = () => <button><Sparkle24Regular /> Ask</button>;",
+ ].join("\n");
+ assert.deepStrictEqual(sparkleLines(repro), [1, 3]);
+
+ // The unsized names and every size the package ships
+ for (const style of ["Regular", "Filled"]) {
+ for (const size of ["", "12", "16", "20", "24", "28", "32", "48"]) {
+ const name = `Sparkle${size}${style}`;
+ assert.deepStrictEqual(sparkleLines(`const Ask = () => <${name} />;\n`), [1], name);
+ }
+ }
+
+ // Other Fluent icons stay quiet
+ assert.deepStrictEqual(sparkleLines('import { Star24Regular, StarFilled } from "@fluentui/react-icons";\n'), []);
+ assert.deepStrictEqual(sparkleLines("const Rating = () => <><Star24Regular /><StarFilled /></>;\n"), []);
+ // Longer names that only start or end the same way
+ assert.deepStrictEqual(sparkleLines("const SparkleCounter = () => null;\n"), []);
+ assert.deepStrictEqual(sparkleLines("const Sparkle24RegularBadge = () => null;\n"), []);
+ assert.deepStrictEqual(sparkleLines("const MySparkleFilled = () => null;\n"), []);
+ assert.deepStrictEqual(sparkleLines("const Sparkle24 = 24;\n"), []);
+});
+
test("blankComments keeps slashes inside Swift raw strings and still finds later symbols", () => {
const src = [
'let label = #"A "// B"#',