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 Chakra UI v3 Card.Root in nested-cards (#310)
Jay9de760a18dda
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.jsindex aa6ac35..dec4610 100644--- a/skills/unslop-anything/scripts/detect.js+++ b/skills/unslop-anything/scripts/detect.js@@ -992,7 +992,8 @@ const rules = [// Vuetify's v-card, Angular Material's mat-card, Quasar's q-card and Element Plus's el-card nest like ion-card (#202, #228).// Naive UI's n-card and Ant Design Vue's a-card nest like ion-card too (#266).// So does PrimeNG's p-card (#280).- for (const m of matches(/<(Card|IonCard|ion-card|VCard|v-card|mat-card|QCard|q-card|ElCard|el-card|NCard|n-card|ACard|a-card|p-card)(?=[\s/>])/, code)) {+ // Chakra UI v3's Card.Root is the card itself; its Card.Header/Body/Footer parts are not (#305).+ for (const m of matches(/<(Card\.Root|Card|IonCard|ion-card|VCard|v-card|mat-card|QCard|q-card|ElCard|el-card|NCard|n-card|ACard|a-card|p-card)(?=[\s/>])/, code)) {const end = tagEnd(code, m.index + m[0].length);if (end === -1) continue;if (/\/\s*$/.test(code.slice(m.index + m[0].length, end))) continue;@@ -1000,7 +1001,7 @@ const rules = [const close = code.indexOf(`</${tag}>`, end + 1);if (close === -1) continue;const inner = code.slice(end + 1, close);- if (new RegExp(`<${tag}(?=[\\s/>])`).test(inner)) hits.push(m.index);+ if (new RegExp(`<${tag.replace(/\./g, "\\.")}(?=[\\s/>])`).test(inner)) hits.push(m.index);}} else {const card = /\b(?:Elevated|Outlined|Filled)?Card\s*[({]/;diff --git a/test/detect.test.js b/test/detect.test.jsindex 48cbcc9..1141b8b 100644--- a/test/detect.test.js+++ b/test/detect.test.js@@ -1415,6 +1415,18 @@ test("nested-cards flags Quasar q-card and Element Plus el-card nesting, not theassert.deepStrictEqual(cardLines(quasarParts), []);});+test("nested-cards flags Chakra UI v3 Card.Root nesting, not its card parts (issue #305)", () => {+ const rulesFor = (src, file = "Plans.tsx") => scanSource(src, file).filter((f) => f.rule === "nested-cards").map((f) => f.line);+ // Issue #305 repro:+ const nested = 'import { Card } from "@chakra-ui/react";\n\nexport const Plans = () => (\n <Card.Root>\n <Card.Body>\n <Card.Root>\n <Card.Body>Pro plan</Card.Body>\n </Card.Root>\n </Card.Body>\n </Card.Root>\n);\n';+ assert.deepStrictEqual(rulesFor(nested), [4]);+ // A single Card.Root with its parts inside stays quiet.+ assert.deepStrictEqual(rulesFor("<Card.Root>\n <Card.Header>Pro</Card.Header>\n <Card.Body>$9</Card.Body>\n <Card.Footer>Buy</Card.Footer>\n</Card.Root>\n"), []);+ // Sibling Card.Root cards stay quiet.+ assert.deepStrictEqual(rulesFor("<Card.Root><Card.Body>A</Card.Body></Card.Root>\n<Card.Root><Card.Body>B</Card.Body></Card.Root>\n"), []);+ assert.deepStrictEqual(rulesFor("<Card><Card>Pro plan</Card></Card>\n"), [1]);+});+test("nested-cards flags Naive UI n-card and Ant Design Vue a-card nesting, not their card parts (issue #266)", () => {const cardLines = (src, file = "Plans.vue") => scanSource(src, file, { kind: "web" }).filter((f) => f.rule === "nested-cards").map((f) => [f.line, f.severity]);// Issue #266 repro: