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.
JavaScript accessibilityagent-skillsagent-skills-toolsagentsagentskillsai-slopclaudeclaude-codeclaude-skillsexpoflutterfrontendionicjetpack-composemobilereact-nativeswiftuiuiuxvibe-coding
fix(detect): flag Tailwind px and arbitrary translate-y lifts in hover-scale (#260)
tarekooooooodeb0a17a2141
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.jsindex 9fcc404..8e55935 100644--- a/skills/unslop-anything/scripts/detect.js+++ b/skills/unslop-anything/scripts/detect.js@@ -1310,7 +1310,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*|["']&?:hover["']\s*:\s*)\{[^}]*transform:\s*[^;}]*?\b(?:scale(?:3d)?\(\s*(?:1\.(?:0[2-9]\d*|[1-9]\d*)|[2-9]\d*(?:\.\d+)?)\b|translateY\(\s*-\s*(?:\d*\.)?\d+|translate(?:3d)?\(\s*(?:[^,;()]|\([^()]*\))+,\s*-\s*(?:\d*\.)?\d+)|:hover\s*\{[^}]*?(?<![\w-])scale\s*:\s*(?:1\.0[2-9]\d*|1\.[1-9]\d*)\b|:hover\s*\{[^}]*?(?<![\w-])translate\s*:\s*(?:[^\s;}()]|\([^()]*\))+\s+-\s*(?:\d*\.)?\d+|\bwhileHover=\{\s*\{[^}]*?\b(?:scale\s*:\s*(?:1\.(?:0[2-9]\d*|[1-9]\d*)|[2-9]\d*(?:\.\d+)?)|y\s*:\s*-\s*(?:\d*\.)?\d+)\b/, code)].map((m) => m.index);+ return [...matches(/\b(?:group-)?hover:(?:-translate-y-(?:\d|px|\[[^\]]+\])|translate-y-\[-[^\]]+\]|scale-1(?:0[2-9]|[1-9]\d)\b|scale-\[(?:1\.(?:0[2-9]\d*|[1-9]\d*)|[2-9]\d*(?:\.\d+)?)\])|(?:&?:hover\s*|["']&?:hover["']\s*:\s*)\{[^}]*transform:\s*[^;}]*?\b(?:scale(?:3d)?\(\s*(?:1\.(?:0[2-9]\d*|[1-9]\d*)|[2-9]\d*(?:\.\d+)?)\b|translateY\(\s*-\s*(?:\d*\.)?\d+|translate(?:3d)?\(\s*(?:[^,;()]|\([^()]*\))+,\s*-\s*(?:\d*\.)?\d+)|:hover\s*\{[^}]*?(?<![\w-])scale\s*:\s*(?:1\.0[2-9]\d*|1\.[1-9]\d*)\b|:hover\s*\{[^}]*?(?<![\w-])translate\s*:\s*(?:[^\s;}()]|\([^()]*\))+\s+-\s*(?:\d*\.)?\d+|\bwhileHover=\{\s*\{[^}]*?\b(?:scale\s*:\s*(?:1\.(?:0[2-9]\d*|[1-9]\d*)|[2-9]\d*(?:\.\d+)?)|y\s*:\s*-\s*(?:\d*\.)?\d+)\b/, code)].map((m) => m.index);},},{diff --git a/test/detect.test.js b/test/detect.test.jsindex 85c20d7..e4d5283 100644--- a/test/detect.test.js+++ b/test/detect.test.js@@ -1692,6 +1692,30 @@ test("hover-scale flags Tailwind arbitrary scale values of 1.02 and above", () =assert.deepStrictEqual(rulesFor('<div className="hover:scale-105">x</div>\n'), ["hover-scale"]);});+test("hover-scale flags Tailwind translate-y lifts written in px and arbitrary values (issue #246)", () => {+ const lines = (src) => scanSource(src, "Feature.tsx").filter((f) => f.rule === "hover-scale").map((f) => f.line);+ const repro = [+ "export function Feature() {",+ " return (",+ ' <div className="rounded-xl border p-6 transition hover:-translate-y-[2px]">',+ " Fast",+ " </div>",+ " );",+ "}",+ "",+ 'export const Lift = () => <div className="hover:-translate-y-px">Lift</div>;',+ ].join("\n");+ assert.deepStrictEqual(lines(repro), [3, 9]);+ for (const cls of ["hover:-translate-y-px", "hover:-translate-y-[2px]", "hover:translate-y-[-2px]", "group-hover:-translate-y-px", "group-hover:-translate-y-[2px]", "group-hover:translate-y-[-2px]"]) {+ assert.deepStrictEqual(lines(`<div className="${cls}">x</div>\n`), [1], cls);+ }+ // Downward and sideways moves stay quiet, and the numeric step still works.+ for (const cls of ["hover:translate-y-px", "hover:translate-y-[2px]", "hover:-translate-x-1", "hover:-translate-x-[2px]"]) {+ assert.deepStrictEqual(lines(`<div className="${cls}">x</div>\n`), [], cls);+ }+ assert.deepStrictEqual(lines('<div className="hover:-translate-y-1">x</div>\n'), [1]);+});+test("hover-scale flags standalone CSS scale at 1.02 and above, not neutral, shrinking, or similarly named properties", () => {const rulesFor = (src) => scanSource(src, "a.css", { kind: "web" }).map((f) => f.rule);assert.deepStrictEqual(rulesFor(".card:hover { scale: 1.02; }\n"), ["hover-scale"]);