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): glow-shadow skips inset accent bars with no blur

Kam573a6cffa13c
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index e57392c..a83b2bf 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -449,6 +449,28 @@ function gradientScope(text, start, name) {
// ---------- rules ----------
// Each rule gets ctx { code, stack, file } and returns indexes into code.
+function glowLayers(list) {
+ const layers = [];
+ let depth = 0;
+ let start = 0;
+ for (let i = 0; i <= list.length; i++) {
+ const c = list[i];
+ if (c === "(") depth++;
+ else if (c === ")") depth--;
+ else if ((c === "," && depth === 0) || i === list.length) {
+ layers.push(list.slice(start, i));
+ start = i + 1;
+ }
+ }
+ return layers
+ .filter((layer) => {
+ if (!/\binset\b/.test(layer)) return true;
+ const lengths = layer.replace(/[a-z]+\([^)]*\)|#[0-9a-f]+/gi, " ").match(/-?\d*\.?\d+(?:px|rem|em)?\b/g) || [];
+ return lengths.length >= 3 && parseFloat(lengths[2]) > 0;
+ })
+ .join(",");
+}
+
const rules = [
{
id: "slop-gradient",
@@ -521,7 +543,9 @@ const rules = [
find({ code, stack }) {
const hits = [];
for (const m of matches(/\.shadow\(\s*color:\s*([^,)]+)|shadowColor\s*[:=]\s*["']?([^"',;\n}]+)|(?:ambientColor|spotColor)\s*=\s*([^,)\n]+)|BoxShadow\(\s*color:\s*([^,)\n]+)|box-shadow:\s*([^;\n]+)|\bshadow-((?:purple|violet|indigo|pink|fuchsia|blue|cyan|teal)-\d{2,3})\b|\bshadow-\[([^\]\n]+)\]/, code)) {
- const value = m.slice(1).find(Boolean) || "";
+ const raw = m.slice(1).find(Boolean) || "";
+ const value = m[5] || m[7] ? glowLayers(raw.replace(/_/g, " ")) : raw;
+ if (!value) continue;
if (/black|gray|grey|shadow|\.primary\b|label|0x[0-9a-f]{2}000000|#000(?:000)?(?:[0-9a-f]{2})?\b|#000[0-9a-f]\b|rgba?\([\s_]*0(?:[\s_]*,[\s_]*|[\s_]+)0(?:[\s_]*,[\s_]*|[\s_]+)0/i.test(value)) continue;
const named = /(?:\.|Colors\.|Color\.|\b)(purple|deepPurple|indigo|violet|pink|magenta|fuchsia|blue|cyan|teal|mint|accentColor|accent)\b/i.test(value);
const hex = hexColors(value, stack).some(isSaturated);
diff --git a/test/detect.test.js b/test/detect.test.js
index 1e43b2a..b6c23c2 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -942,6 +942,43 @@ test("glow-shadow catches Tailwind colored and arbitrary shadows while ignoring
assert.deepStrictEqual(scanSource(neutral, "a.tsx"), []);
});
+test("glow-shadow skips inset accent bars with no blur (#111)", () => {
+ const bars = [
+ ".line.highlighted {",
+ " box-shadow: inset 2px 0 0 rgb(226 86 15 / 0.6);",
+ "}",
+ ".tab.active {",
+ " box-shadow: inset 0 -2px 0 #e0763f;",
+ "}",
+ ".edge {",
+ " box-shadow: inset 0 1px #7c3aed;",
+ "}",
+ ].join("\n");
+ assert.deepStrictEqual(scanSource(bars, "a.css"), []);
+ assert.deepStrictEqual(scanSource('<div className="shadow-[inset_2px_0_0_#e0763f]">x</div>', "a.tsx"), []);
+
+ const glows = [
+ ".btn {",
+ " box-shadow: 0 0 24px rgb(224 118 63 / 0.7);",
+ "}",
+ ".ring {",
+ " box-shadow: inset 0 0 12px #7c3aed;",
+ "}",
+ ".mixed {",
+ " box-shadow: inset 2px 0 0 #e0763f, 0 0 30px #7c3aed;",
+ "}",
+ ].join("\n");
+ assert.deepStrictEqual(scanSource(glows, "a.css").map((f) => [f.rule, f.line]), [
+ ["glow-shadow", 2],
+ ["glow-shadow", 5],
+ ["glow-shadow", 8],
+ ]);
+ assert.deepStrictEqual(
+ scanSource('<div className="shadow-[0_0_40px_#7c3aed]">x</div>', "a.tsx").map((f) => f.rule),
+ ["glow-shadow"],
+ );
+});
+
test("hover-scale flags Tailwind arbitrary scale values of 1.02 and above", () => {
const rulesFor = (src) => scanSource(src, "a.tsx").map((f) => f.rule);
// The issue's example line, plus the group- prefix variant.