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 Bootstrap Icons' stars in sparkle-icon (#292)

Pranav Aryacceb9132abbb
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index cb2657a..8f3615b 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1047,7 +1047,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-])/;
+ 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 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 28aca23..7c2983d 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -2126,6 +2126,33 @@ test("sparkle-icon flags Font Awesome's faSparkles and fa-sparkles (issue #267)"
assert.deepStrictEqual(sparkleLines('<i className="fa-solid fa-wand-magic-sparkles" />\n'), [1]);
});
+test("sparkle-icon flags Bootstrap Icons' BsStars and bi-stars, not the single rating star (issue #282)", () => {
+ const sparkleLines = (src, file = "Ask.tsx") => scanSource(src, file).filter((f) => f.rule === "sparkle-icon").map((f) => f.line);
+ // Issue #282 repro:
+ const repro = [
+ 'import { BsStars } from "react-icons/bs";',
+ "",
+ "export const Ask = () => <button><BsStars /> Ask</button>;",
+ 'export const Old = () => <i className="bi bi-stars" />;',
+ ].join("\n");
+ assert.deepStrictEqual(sparkleLines(repro), [1, 3, 4]);
+
+ // Plain HTML
+ assert.deepStrictEqual(sparkleLines('<i class="bi-stars"></i>\n', "index.html"), [1]);
+ assert.deepStrictEqual(sparkleLines('<i class="bi bi-stars fs-4"></i>\n', "index.html"), [1]);
+
+ // The single star used for ratings stays quiet
+ assert.deepStrictEqual(sparkleLines('import { BsStar, BsStarFill, BsStarHalf } from "react-icons/bs";\n'), []);
+ assert.deepStrictEqual(sparkleLines("const Rating = () => <><BsStarFill /><BsStarHalf /><BsStar /></>;\n"), []);
+ assert.deepStrictEqual(sparkleLines('<i className="bi bi-star" />\n'), []);
+ assert.deepStrictEqual(sparkleLines('<i className="bi bi-star-fill" />\n'), []);
+ assert.deepStrictEqual(sparkleLines('<i className="bi bi-star-half" />\n'), []);
+ // Longer names that only start the same way
+ assert.deepStrictEqual(sparkleLines("const BsStarsRow = () => null;\n"), []);
+ assert.deepStrictEqual(sparkleLines('<i className="bi-stars-row" />\n'), []);
+ assert.deepStrictEqual(sparkleLines('<i className="kbi-stars" />\n'), []);
+});
+
test("blankComments keeps slashes inside Swift raw strings and still finds later symbols", () => {
const src = [
'let label = #"A "// B"#',