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 CSS translateY lift on hover in hover-scale (#180) (#186)

Papito084445a621e80a0
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index 41a3ee0..d69eb25 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1278,7 +1278,7 @@ const rules = [
message: "Cards that grow on hover.",
fix: "Show hover with a quick color or surface change. Keep scale for a small press-down on buttons.",
find({ code }) {
- return [...matches(/\b(?:group-)?hover:(?:-translate-y-\d|scale-1(?:0[2-9]|[1-9]\d)\b|scale-\[(?:1\.(?:0[2-9]\d*|[1-9]\d*)|[2-9]\d*(?:\.\d+)?)\])|:hover\s*\{[^}]*transform:\s*scale\(1\.(?:0[2-9]|[1-9])|:hover\s*\{[^}]*?(?<![\w-])scale\s*:\s*(?:1\.0[2-9]\d*|1\.[1-9]\d*)\b/, code)].map((m) => m.index);
+ return [...matches(/\b(?:group-)?hover:(?:-translate-y-\d|scale-1(?:0[2-9]|[1-9]\d)\b|scale-\[(?:1\.(?:0[2-9]\d*|[1-9]\d*)|[2-9]\d*(?:\.\d+)?)\])|:hover\s*\{[^}]*transform:\s*(?:scale\(1\.(?:0[2-9]|[1-9])|[^;}]*?\btranslateY\(\s*-\s*(?:\d*\.)?\d+)|:hover\s*\{[^}]*?(?<![\w-])scale\s*:\s*(?:1\.0[2-9]\d*|1\.[1-9]\d*)\b/, code)].map((m) => m.index);
},
},
{
diff --git a/test/detect.test.js b/test/detect.test.js
index d6cddb5..3a0f70c 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -1466,6 +1466,14 @@ test("hover-scale flags standalone CSS scale at 1.02 and above, not neutral, shr
assert.deepStrictEqual(rulesFor(".card:hover { custom-scale: 1.1; }\n"), []);
});
+test("hover-scale flags CSS transform translateY lift, but not zero or downward presses", () => {
+ const rulesFor = (src) => scanSource(src, "a.css", { kind: "web" }).map((f) => f.rule);
+ assert.deepStrictEqual(rulesFor(".card:hover { transform: translateY(-4px); }\n"), ["hover-scale"]);
+ assert.deepStrictEqual(rulesFor(".card:hover { transform: translateY(-0.5rem); }\n"), ["hover-scale"]);
+ assert.deepStrictEqual(rulesFor(".card:hover { transform: translateY(0); }\n"), []);
+ assert.deepStrictEqual(rulesFor(".button:hover { transform: translateY(1px); }\n"), []);
+});
+
test("glow-shadow catches Android shadowColor on one line or with alpha", () => {
const oneLine = '<TextView android:shadowColor="#7C3AED" android:shadowRadius="20" />';
const multiLine = '<TextView\n android:shadowColor="#807C3AED"\n android:shadowRadius="20" />';