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 Iconify and Nuxt sparkle icon names in sparkle-icon (#176) (#187)

Papito0844b80a1b24888
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index d69eb25..64f285a 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1007,11 +1007,12 @@ const rules = [
find({ code, stack }) {
// SF Symbols are often derived from "sparkle"/"sparkles" or
// "wand.and.stars"/"wand.and.sparkles", for example
- // "sparkles.rectangle.stack" and "wand.and.stars.inverse". Check the
- // complete string literal so a quoted symbol is only flagged 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._-]+)?)$/;
+ // "sparkles.rectangle.stack" and "wand.and.stars.inverse". Iconify
+ // names take the form "<set>:sparkles?" or the Nuxt "i-<set>-sparkles?".
+ // Check the complete string literal so a quoted symbol is only flagged
+ // 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?)$/;
const re = /\bauto_awesome\b|\bAutoAwesome\b|\bSparkles\b|\bSparklesIcon\b|\bSparkle\b|\bSparkleIcon\b|\bWandSparkles\b|\bWandSparklesIcon\b|✨/;
const hits = [...matches(re, code)].map((m) => m.index);
diff --git a/test/detect.test.js b/test/detect.test.js
index 3a0f70c..3350fae 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -1543,6 +1543,23 @@ test("sparkle-icon scans nested Swift interpolation and raw strings", () => {
assert.deepStrictEqual(scanSource(prose, "a.swift"), []);
});
+test("sparkle-icon flags Iconify and Nuxt sparkle icon names, not prose or unrelated icons", () => {
+ const vue = [
+ "<template>",
+ ' <Icon icon="lucide:sparkles" />',
+ ' <UIcon name="i-lucide-sparkles" />',
+ ' <Icon icon="mdi:sparkle" />',
+ ' <Icon icon="heroicons:sparkles" />',
+ ' <Icon icon="ph:sparkle" />',
+ ' <Icon icon="tabler:sparkles" />',
+ ' <p>Add some sparkles</p>',
+ ' <Icon icon="lucide:star" />',
+ "</template>",
+ ].join("\n");
+ const findings = scanSource(vue, "Badge.vue").filter((f) => f.rule === "sparkle-icon");
+ assert.deepStrictEqual(findings.map((f) => f.line), [2, 3, 4, 5, 6, 7]);
+});
+
test("blankComments keeps slashes inside Swift raw strings and still finds later symbols", () => {
const src = [
'let label = #"A "// B"#',