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): use tagEnd when reading ScrollView props in unvirtualized-list (#184)
Onur Ugur02247d6af619
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.jsindex 4f39e10..a9c293a 100644--- a/skills/unslop-anything/scripts/detect.js+++ b/skills/unslop-anything/scripts/detect.js@@ -1054,12 +1054,16 @@ const rules = [const hits = [];if (stack === "js") {for (const m of matches(/(?<![\w.])<(?:Animated\.)?ScrollView\b/, code)) {- const end = code.slice(m.index).search(/<\/(?:Animated\.)?ScrollView>/);- if (end === -1) continue;- const body = code.slice(m.index, m.index + end);+ const openEnd = tagEnd(code, m.index + m[0].length);+ if (openEnd === -1) continue;+ if (/\/\s*$/.test(code.slice(m.index + m[0].length, openEnd))) continue;+ const rest = code.slice(openEnd + 1);+ const closeRel = rest.search(/<\/(?:Animated\.)?ScrollView>/);+ if (closeRel === -1) continue;// Horizontal scrollers are usually short chip rows and carousels.- const props = body.slice(0, body.indexOf(">") + 1);+ const props = code.slice(m.index, openEnd + 1);if (/\bhorizontal\b(?!\s*=\s*\{\s*false\s*\})/.test(props)) continue;+ const body = rest.slice(0, closeRel);if (/\.map\(/.test(body)) hits.push(m.index);}}diff --git a/test/detect.test.js b/test/detect.test.jsindex b427418..751e0b5 100644--- a/test/detect.test.js+++ b/test/detect.test.js@@ -418,6 +418,17 @@ test("horizontal={false} is still a vertical list", () => {assert.deepStrictEqual(scanSource(src, "a.tsx").map((f) => f.rule), ["unvirtualized-list"]);});+test("unvirtualized-list reads ScrollView props with tagEnd so arrows before horizontal stay quiet", () => {+ const rulesFor = (src) => scanSource(src, "a.tsx").filter((f) => f.rule === "unvirtualized-list").map((f) => f.line);+ assert.deepStrictEqual(rulesFor("<ScrollView onScroll={(e) => log(e)} horizontal>{chips.map((c) => <Chip key={c} />)}</ScrollView>\n"), []);+ assert.deepStrictEqual(rulesFor("<ScrollView style={{ padding: count > 0 ? 8 : 0 }} horizontal>{chips.map((c) => <Chip key={c} />)}</ScrollView>\n"), []);+ assert.deepStrictEqual(rulesFor("<ScrollView stickyHeaderIndices={headers.map((_, i) => i)}><Text>Static</Text></ScrollView>\n"), []);+ // Vertical ScrollViews with arrow props still flag, and a self-closing ScrollView does not swallow a later one.+ assert.deepStrictEqual(rulesFor("<ScrollView onScroll={(e) => log(e)}>{items.map((i) => <Row key={i} />)}</ScrollView>\n"), [1]);+ assert.deepStrictEqual(rulesFor("<ScrollView onScroll={(e) => log(e)} horizontal={false}>{items.map((i) => <Row key={i} />)}</ScrollView>\n"), [1]);+ assert.deepStrictEqual(rulesFor("<ScrollView onScroll={(e) => log(e)} />\n<ScrollView>{items.map((i) => <Row key={i} />)}</ScrollView>\n"), [2]);+});+test("Android color resources reach template-theme", () => {const src = '<resources>\n <color name="purple_500">#6200EE</color>\n</resources>\n';assert.deepStrictEqual(scanSource(src, "colors.xml").map((f) => f.rule), ["template-theme"]);