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 transitionProperty: "all" in JS style objects (#212)

susheelg119767d47982ae59
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index 5f77506..0b34070 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1298,7 +1298,7 @@ const rules = [
// A shorthand whose first layer names no property (`transition: .3s
// ease`, `transition: ease-in 200ms`) defaults to `all` as well; the
// whole layer must be timing values, so `.2s opacity` stays quiet.
- const first = matches(/\btransition-all\b|transition(?:-property)?:\s*["'`]?[^;{}"'`]*?(?<![\w-])all(?![\w-])|(?<![\w-])transition:\s*["'`]?\s*(?:(?:ease(?:-in-out|-in|-out)?|linear(?:\([^)]*\))?|step-start|step-end|(?:cubic-bezier|steps)\([^)]*\)|allow-discrete|normal)\s+)*\d*\.?\d+m?s\b(?:\s+(?:(?:ease(?:-in-out|-in|-out)?|linear(?:\([^)]*\))?|step-start|step-end|(?:cubic-bezier|steps)\([^)]*\)|allow-discrete|normal)|\d*\.?\d+m?s\b))*\s*(?=[,;}"'`\n]|$)/, code).next();
+ const first = matches(/\btransition-all\b|transition(?:-property|Property)?:\s*["'`]?[^;{}"'`]*?(?<![\w-])all(?![\w-])|(?<![\w-])transition:\s*["'`]?\s*(?:(?:ease(?:-in-out|-in|-out)?|linear(?:\([^)]*\))?|step-start|step-end|(?:cubic-bezier|steps)\([^)]*\)|allow-discrete|normal)\s+)*\d*\.?\d+m?s\b(?:\s+(?:(?:ease(?:-in-out|-in|-out)?|linear(?:\([^)]*\))?|step-start|step-end|(?:cubic-bezier|steps)\([^)]*\)|allow-discrete|normal)|\d*\.?\d+m?s\b))*\s*(?=[,;}"'`\n]|$)/, code).next();
return first.done ? [] : [first.value.index];
},
},
diff --git a/test/detect.test.js b/test/detect.test.js
index b3d631b..8ae1d42 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -565,6 +565,19 @@ test("transition-all flags a shorthand that names no property, since it defaults
assert.deepStrictEqual(rulesFor(".card { transition: .2s ease 0.1s; }\n"), ["transition-all"]);
});
+test("transition-all flags transitionProperty: \"all\" in JS style objects, not named properties or longer words", () => {
+ const lines = (src) => scanSource(src, "card.ts", { kind: "web" }).filter((f) => f.rule === "transition-all").map((f) => [f.line, f.severity]);
+ // Issue #205: the repro.
+ assert.deepStrictEqual(lines('export const card = {\n transitionProperty: "all",\n transitionDuration: "200ms",\n};\n'), [[2, "minor"]]);
+ for (const quote of ["'", "`"]) {
+ assert.deepStrictEqual(lines(`const s = { transitionProperty: ${quote}all${quote} };\n`).map(([line]) => line), [1], quote);
+ }
+ assert.deepStrictEqual(lines('const s = { transitionProperty: "opacity, transform" };\n'), []);
+ assert.deepStrictEqual(lines('const s = { transitionProperty: "color, all" };\n').map(([line]) => line), [1]);
+ assert.deepStrictEqual(lines('const s = { transitionProperty: "allowed" };\n'), []);
+ assert.deepStrictEqual(lines('const s = { transitionProperty: "opacity", pointerEvents: "all" };\n'), []);
+});
+
test("reduced-motion flags animations with no prefers-reduced-motion fallback (issue #72)", () => {
// The issue's exact repro: a @keyframes animation with no fallback.
const repro = ".badge { animation: bounce 1s infinite; }\n@keyframes bounce { 50% { transform: translateY(-4px); } }\n";