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): check Shoelace's sl-card in nested-cards (#348)
mohamad mirzaii0e454778774d
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.jsindex 19efab1..8c60fe0 100644--- a/skills/unslop-anything/scripts/detect.js+++ b/skills/unslop-anything/scripts/detect.js@@ -993,8 +993,9 @@ const rules = [// 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).// NG-ZORRO's nz-card nests the same way (#326).+ // Shoelace's sl-card web component too (#342).// 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|nz-card)(?=[\s/>])/, code)) {+ 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|nz-card|sl-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;diff --git a/test/detect.test.js b/test/detect.test.jsindex e697d83..fe47ffb 100644--- a/test/detect.test.js+++ b/test/detect.test.js@@ -1527,6 +1527,23 @@ test("nested-cards flags NG-ZORRO nz-card nesting, not its card parts (issue #32assert.deepStrictEqual(cardLines("<mat-card>\n <mat-card>Pro plan</mat-card>\n</mat-card>\n"), [[1, "noticeable"]]);});+test("nested-cards flags Shoelace sl-card nesting, not other sl- tags inside one card (issue #342)", () => {+ const cardLines = (src, file = "plans.html") => scanSource(src, file, { kind: "web" }).filter((f) => f.rule === "nested-cards").map((f) => [f.line, f.severity]);+ // Issue #342 repro:+ assert.deepStrictEqual(cardLines("<sl-card>\n <sl-card>Pro plan</sl-card>\n</sl-card>\n"), [[1, "noticeable"]]);++ // With attributes, and with the inner card a few levels down+ assert.deepStrictEqual(cardLines('<sl-card class="plans">\n <div>\n <sl-card class="pro">Pro plan</sl-card>\n </div>\n</sl-card>\n'), [[1, "noticeable"]]);++ // A single card, sibling cards and other Shoelace tags inside one card stay quiet+ assert.deepStrictEqual(cardLines("<sl-card>Pro plan</sl-card>\n"), []);+ assert.deepStrictEqual(cardLines("<sl-card>Pro</sl-card>\n<sl-card>Team</sl-card>\n"), []);+ assert.deepStrictEqual(cardLines('<sl-card>\n <div slot="header">Pro</div>\n <sl-badge>New</sl-badge>\n <sl-button slot="footer">Buy</sl-button>\n</sl-card>\n'), []);++ // The existing cards keep working+ assert.deepStrictEqual(cardLines("<mat-card>\n <mat-card>Pro plan</mat-card>\n</mat-card>\n"), [[1, "noticeable"]]);+});+test("nested-cards reads opening tags with tagEnd so arrows or > in props do not misread sibling cards", () => {const rulesFor = (src, file = "a.tsx") => scanSource(src, file).filter((f) => f.rule === "nested-cards").map((f) => f.rule);assert.deepStrictEqual(rulesFor("<Card onClick={() => open()} />\n<Card><p>Second</p></Card>\n"), []);