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: flag `<Sparkle />`, `<SparkleIcon />` and `<WandSparkles />` icons (#84)

Nguyễn Tuấn Anhc8090ec3ebe4
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index ac03fc5..e45afd2 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -497,7 +497,7 @@ const rules = [
message: "Sparkle icon. It usually marks an AI feature or stands in for meaning.",
fix: "Use an icon that names the action, or a text label. If it marks an AI feature, make sure that feature is not in the way of the core task.",
find({ code }) {
- const re = /["']sparkles?["']|["']wand\.and\.stars|\bauto_awesome\b|\bAutoAwesome\b|\bSparkles\b|\bSparklesIcon\b|✨/;
+ const re = /["']sparkles?["']|["']wand\.and\.stars|\bauto_awesome\b|\bAutoAwesome\b|\bSparkles\b|\bSparklesIcon\b|\bSparkle\b|\bSparkleIcon\b|\bWandSparkles\b|\bWandSparklesIcon\b|✨/;
return [...matches(re, code)].map((m) => m.index);
},
},
diff --git a/test/detect.test.js b/test/detect.test.js
index 432ac66..9252433 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -679,3 +679,17 @@ test("glow-shadow catches Android shadowColor on one line or with alpha", () =>
const neutral = '<TextView android:shadowColor="#80000000" android:shadowRadius="20" />';
assert.deepStrictEqual(scanSource(neutral, "a.xml"), []);
});
+
+test("sparkle-icon flags the singular and combined icon names", () => {
+ const rulesFor = (src) => scanSource(src, "a.tsx").map((f) => f.rule);
+ // Issue #45: these gave no finding before the fix.
+ assert.deepStrictEqual(rulesFor("<Sparkle />\n"), ["sparkle-icon"]);
+ assert.deepStrictEqual(rulesFor("<SparkleIcon />\n"), ["sparkle-icon"]);
+ assert.deepStrictEqual(rulesFor("<WandSparkles />\n"), ["sparkle-icon"]);
+ assert.deepStrictEqual(rulesFor("<WandSparklesIcon />\n"), ["sparkle-icon"]);
+ // Still flagged, as before.
+ assert.deepStrictEqual(rulesFor("<Sparkles />\n"), ["sparkle-icon"]);
+ // A word that only contains the letters is a different component, not a
+ // sparkle icon: word boundaries keep SparkleCounter unflagged.
+ assert.deepStrictEqual(rulesFor("<SparkleCounter />\n"), []);
+});