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: flag `all` anywhere in a transition list (#46)

Nguyễn Tuấn Anhe754757ee34a
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index f590e56..bb7f888 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -629,7 +629,10 @@ const rules = [
fix: "Name the properties: transition-colors, or transition-[transform,opacity]. Never animate width, height, top, or left.",
find({ code }) {
// Reported once per file: it is usually a habit, not a one-off.
- const first = matches(/\btransition-all\b|transition(?:-property)?:\s*all\b/, code).next();
+ // `all` may sit anywhere in the list, not just first:
+ // `transition: color .2s, all .3s` counts, but a property name that
+ // merely starts with `all` (e.g. `all-in-one`) does not.
+ const first = matches(/\btransition-all\b|transition(?:-property)?:[^;{}]*?(?<![\w-])all(?![\w-])/, code).next();
return first.done ? [] : [first.value.index];
},
},
diff --git a/test/detect.test.js b/test/detect.test.js
index a84f93d..dafdefc 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -145,6 +145,18 @@ test("Android color resources reach template-theme", () => {
assert.deepStrictEqual(scanSource(src, "colors.xml").map((f) => f.rule), ["template-theme"]);
});
+test("transition-all flags `all` anywhere in a transition list", () => {
+ const flagged = ".x { transition: color .2s, all .3s; }\n";
+ assert.deepStrictEqual(scanSource(flagged, "a.css").map((f) => f.rule), ["transition-all"]);
+ const property = ".y { transition-property: all; }\n";
+ assert.deepStrictEqual(scanSource(property, "a.css").map((f) => f.rule), ["transition-all"]);
+ // A property name that merely starts with `all` is not `all`.
+ const allInOne = ".a { transition: all-in-one .2s; }\n";
+ assert.deepStrictEqual(scanSource(allInOne, "a.css"), []);
+ const named = ".b { transition: color .2s; }\n";
+ assert.deepStrictEqual(scanSource(named, "a.css"), []);
+});
+
test("slop-gradient reads Android #AARRGGBB colors", () => {
const src = '<gradient android:startColor="#FF7C3AED" android:endColor="#FFEC4899"/>\n';
assert.deepStrictEqual(scanSource(src, "bg.xml").map((f) => f.rule), ["slop-gradient"]);