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.

Add Vue, Svelte, Astro and Ionic fixtures (#106)

Nguyễn Tuấn Anh5eaef0564350
diff --git a/test/detect.test.js b/test/detect.test.js
index d415fe5..989cd59 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -579,13 +579,37 @@ test("web slop is caught", () => {
for (const id of [
"slop-gradient", "gradient-text", "tracked-caps-label", "unverified-claim", "img-no-alt", "decorative-pulse",
"clickable-div", "transition-all", "hover-scale", "icon-tile", "focus-removed", "zoom-disabled", "reduced-motion",
- "placeholder-label",
+ "placeholder-label", "nested-cards",
]) assert.ok(found.has(id), `missing ${id}`);
});
+test("Vue, Svelte and Astro slop is caught", () => {
+ for (const file of ["Pricing.vue", "Card.svelte", "Hero.astro"]) {
+ const found = rulesIn(path.join("web", file));
+ for (const id of ["clickable-div", "img-no-alt", "transition-all"]) {
+ assert.ok(found.has(id), `${file} missing ${id}`);
+ }
+ }
+});
+
+test("JS comments inside Vue, Svelte and Astro script blocks are ignored", () => {
+ for (const file of ["Pricing.vue", "Card.svelte", "Hero.astro"]) {
+ const found = rulesIn(path.join("web", file));
+ assert.ok(!found.has("oops-error"), `${file} flagged oops-error`);
+ }
+});
+
+test("Ionic drawer-nav fires on a universal scan", () => {
+ const found = new Set(
+ scan([path.join(fixtures, "slop", "web", "Ionic.html")], { platform: "universal" }).findings.map((f) => f.rule),
+ );
+ assert.ok(found.has("drawer-nav"), "missing drawer-nav");
+ assert.ok(found.has("nested-cards"), "missing nested-cards");
+});
+
test("clean web fixtures produce no findings", () => {
const { findings, filesScanned } = scan([path.join(fixtures, "clean-web")]);
- assert.strictEqual(filesScanned, 2);
+ assert.strictEqual(filesScanned, 6);
assert.deepStrictEqual(findings, []);
});
diff --git a/test/fixtures/clean-web/Card.svelte b/test/fixtures/clean-web/Card.svelte
new file mode 100644
index 0000000..585db2a
--- /dev/null
+++ b/test/fixtures/clean-web/Card.svelte
@@ -0,0 +1,9 @@
+<script>
+ let plan = "Pro";
+ const select = (plan) => console.log(plan);
+</script>
+
+<button class="card transition-colors" on:click={() => select(plan)}>
+ {plan}
+</button>
+<img src="/card.png" alt="Card preview" />
diff --git a/test/fixtures/clean-web/Hero.astro b/test/fixtures/clean-web/Hero.astro
new file mode 100644
index 0000000..90dee18
--- /dev/null
+++ b/test/fixtures/clean-web/Hero.astro
@@ -0,0 +1,9 @@
+---
+const title = "Ship faster";
+---
+
+<section>
+ <h1>{title}</h1>
+ <a class="hero transition-colors" href="/pricing">See pricing</a>
+ <img src="/hero.png" alt="Product screenshot" />
+</section>
diff --git a/test/fixtures/clean-web/Ionic.html b/test/fixtures/clean-web/Ionic.html
new file mode 100644
index 0000000..8b5fdae
--- /dev/null
+++ b/test/fixtures/clean-web/Ionic.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<html>
+ <body>
+ <ion-card>
+ <h2>Welcome</h2>
+ <p>Your dashboard is ready.</p>
+ <img src="/welcome.png" alt="Dashboard overview" />
+ </ion-card>
+ </body>
+</html>
diff --git a/test/fixtures/clean-web/Pricing.vue b/test/fixtures/clean-web/Pricing.vue
new file mode 100644
index 0000000..16613ac
--- /dev/null
+++ b/test/fixtures/clean-web/Pricing.vue
@@ -0,0 +1,14 @@
+<template>
+ <section class="pricing">
+ <h1>Simple pricing</h1>
+ <button class="plan transition-colors" @click="select('pro')">
+ <span>Pro plan</span>
+ <span>$29 per month</span>
+ </button>
+ <img src="/pro.png" alt="Pro plan dashboard preview" />
+ </section>
+</template>
+
+<script setup>
+const select = (plan) => console.log(plan);
+</script>
diff --git a/test/fixtures/slop/web/Card.svelte b/test/fixtures/slop/web/Card.svelte
new file mode 100644
index 0000000..df0b46a
--- /dev/null
+++ b/test/fixtures/slop/web/Card.svelte
@@ -0,0 +1,10 @@
+<script>
+ let plan = "Pro";
+ // const t = "Oops"
+ const select = (plan) => console.log(plan);
+</script>
+
+<div class="card transition-all" on:click={() => select(plan)}>
+ <h2>{plan}</h2>
+ <img src="/card.png" />
+</div>
diff --git a/test/fixtures/slop/web/Hero.astro b/test/fixtures/slop/web/Hero.astro
new file mode 100644
index 0000000..8fbb822
--- /dev/null
+++ b/test/fixtures/slop/web/Hero.astro
@@ -0,0 +1,12 @@
+---
+const title = "Ship faster";
+// const t = "Oops"
+---
+
+<section>
+ <h1>{title}</h1>
+ <div class="hero transition-all hover:scale-105" @click={go}>
+ <h2>Pro plan</h2>
+ <img src="/hero.png" />
+ </div>
+</section>
diff --git a/test/fixtures/slop/web/Ionic.html b/test/fixtures/slop/web/Ionic.html
new file mode 100644
index 0000000..725948e
--- /dev/null
+++ b/test/fixtures/slop/web/Ionic.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<html>
+ <body>
+ <ion-menu content-id="main">
+ <ion-header>
+ <ion-toolbar>
+ <ion-title>Menu</ion-title>
+ </ion-toolbar>
+ </ion-header>
+ <ion-content>
+ <ion-list>
+ <ion-item>Home</ion-item>
+ </ion-list>
+ </ion-content>
+ </ion-menu>
+ <div id="main">
+ <ion-card>
+ <ion-card-header>
+ <ion-card-title>Outer card</ion-card-title>
+ </ion-card-header>
+ <ion-card-content>
+ <ion-card>
+ <ion-card-content>Inner card</ion-card-content>
+ </ion-card>
+ </ion-card-content>
+ </ion-card>
+ </div>
+ </body>
+</html>
diff --git a/test/fixtures/slop/web/Pricing.vue b/test/fixtures/slop/web/Pricing.vue
new file mode 100644
index 0000000..0a767b0
--- /dev/null
+++ b/test/fixtures/slop/web/Pricing.vue
@@ -0,0 +1,15 @@
+<template>
+ <section class="pricing">
+ <h1>Simple pricing</h1>
+ <div class="plan transition-all hover:scale-105" @click="select('pro')">
+ <h2>Pro plan</h2>
+ <p>$29 per month</p>
+ <img src="/pro.png" />
+ </div>
+ </section>
+</template>
+
+<script setup>
+// const t = "Oops"
+const select = (plan) => console.log(plan);
+</script>