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(rules): recognize JS reduced-motion guards in reduced-motion (#124)
Papito08420606084c7b0
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.jsindex 123e0a9..f6fc77e 100644--- a/skills/unslop-anything/scripts/detect.js+++ b/skills/unslop-anything/scripts/detect.js@@ -951,12 +951,14 @@ const rules = [severity: "minor",stacks: ["js", "web", "css"],message: "Animation with no prefers-reduced-motion fallback (first use in this file).",- fix: "Add a @media (prefers-reduced-motion: reduce) fallback that stops the animation, or guard the class with a motion-reduce: variant.",+ fix: "Add a @media (prefers-reduced-motion: reduce) fallback, guard the class with a motion-reduce: variant, or check useReducedMotion() / AccessibilityInfo in JS.",find({ code }) {// Reported once per file, like transition-all: a missing fallback// is usually a habit, not a one-off. A fallback anywhere in the// file covers it, so the check is file-wide.- if (/prefers-reduced-motion/.test(code)) return [];+ if (/prefers-reduced-motion|\breduceMotionChanged\b/.test(code)) return [];+ const unquoted = code.replace(/"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`/g, '""');+ if (/\buseReducedMotion(?:Config)?\s*\(|\bAccessibilityInfo\.isReduceMotionEnabled\b|\bReduceMotion\./.test(unquoted)) return [];const hits = [];// Plain CSS: the first @keyframes block or animation: declaration.const css = matches(/@keyframes\b|\banimation\s*:\s*["'`]?(?!none\b)[^;"'`\n]*?\d*\.?\d+m?s\b/, code).next();diff --git a/test/detect.test.js b/test/detect.test.jsindex 57c03aa..25db29f 100644--- a/test/detect.test.js+++ b/test/detect.test.js@@ -382,6 +382,32 @@ test("reduced-motion flags animations with no prefers-reduced-motion fallback (iassert.deepStrictEqual(scanSource('<Stack.Screen options={{ animation: "slide_from_right" }} />\n', "a.tsx"), []);assert.deepStrictEqual(scanSource("const options = { animation: false };\n", "a.ts"), []);assert.deepStrictEqual(scanSource('const Badge = styled.span`animation: ${bounce} 1s infinite;`;\n', "a.tsx").map((f) => f.rule), ["reduced-motion"]);+ // JS reduced-motion guards (framer-motion, Reanimated, React Native) silence it.+ assert.deepStrictEqual(+ scanSource('import { useReducedMotion } from "framer-motion";\nexport function Hero() { const r = useReducedMotion(); return <div className={r ? "" : "animate-bounce"} />; }\n', "Hero.tsx"),+ [],+ );+ assert.deepStrictEqual(+ scanSource('import { useReducedMotionConfig, ReduceMotion } from "react-native-reanimated";\nexport function Card() { const r = useReducedMotionConfig(); return <div className="animate-bounce" />; }\n', "Card.tsx"),+ [],+ );+ assert.deepStrictEqual(+ scanSource('const mode = ReduceMotion.System;\nexport const X = () => <div className="animate-bounce" />;\n', "Card.tsx"),+ [],+ );+ assert.deepStrictEqual(+ scanSource('AccessibilityInfo.isReduceMotionEnabled().then(setReduce);\nexport const X = () => <div className="animate-bounce" />;\n', "Card.tsx"),+ [],+ );+ assert.deepStrictEqual(+ scanSource('AccessibilityInfo.addEventListener("reduceMotionChanged", setReduce);\nexport const X = () => <div className="animate-bounce" />;\n', "Card.tsx"),+ [],+ );+ // Comments or strings mentioning useReducedMotion do not count as a fallback.+ assert.deepStrictEqual(+ scanSource('// useReducedMotion()\nconst label = "useReducedMotion()";\nexport const X = () => <div className="animate-bounce" />;\n', "Hero.tsx").map((f) => f.rule),+ ["reduced-motion"],+ );});test("slop-gradient reads Android #AARRGGBB colors", () => {