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 MUI AutoAwesomeIcon and styled variants in sparkle-icon (#242)

Papito084f9581caf7fa9
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index ec36549..acc5682 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1044,7 +1044,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\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|\bMd(?:Outline|Round|Sharp|TwoTone)?AutoAwesome\b|\bfaWandMagicSparkles\b|(?<![\w-])fa-wand-magic-sparkles(?![\w-])/;
+ 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|\bMd(?:Outline|Round|Sharp|TwoTone)?AutoAwesome\b|\bfaWandMagicSparkles\b|(?<![\w-])fa-wand-magic-sparkles(?![\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 9cea177..ede3863 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -1776,6 +1776,29 @@ test("sparkle-icon flags react-icons sparkle names, not unrelated icons", () =>
}
});
+test("sparkle-icon flags MUI AutoAwesomeIcon and styled variants (issue #227)", () => {
+ const sparkleLines = (src, file = "AiBadge.tsx") => scanSource(src, file).filter((f) => f.rule === "sparkle-icon").map((f) => f.line);
+ // Issue #227 repro:
+ const repro = [
+ 'import AutoAwesomeIcon from "@mui/icons-material/AutoAwesome";',
+ 'import { AutoAwesomeOutlined } from "@mui/icons-material";',
+ "",
+ "export function AiBadge() {",
+ " return <AutoAwesomeIcon />;",
+ "}",
+ ].join("\n");
+ assert.deepStrictEqual(sparkleLines(repro), [1, 2, 5]);
+
+ for (const name of ["AutoAwesomeIcon", "AutoAwesomeOutlined", "AutoAwesomeRounded", "AutoAwesomeSharp", "AutoAwesomeTwoTone", "AutoAwesomeOutlinedIcon", "AutoAwesomeTwoToneIcon"]) {
+ assert.deepStrictEqual(sparkleLines(`<${name} />\n`), [1], name);
+ }
+
+ // Unrelated AutoAwesomeMosaic and AutoAwesomeMotion stay quiet
+ for (const name of ["AutoAwesomeMosaic", "AutoAwesomeMotion", "AutoAwesomeMosaicOutlined", "AutoAwesomeMotionRounded", "AutoAwesomeMosaicIcon", "AutoAwesomeMotionOutlinedIcon"]) {
+ assert.deepStrictEqual(sparkleLines(`<${name} />\n`), [], name);
+ }
+});
+
test("sparkle-icon flags Font Awesome's wand-magic-sparkles, not the plain wand", () => {
const sparkleLines = (src) => scanSource(src, "Ai.tsx").filter((f) => f.rule === "sparkle-icon").map((f) => f.line);
// Issue #198.