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.

fix(detect): flag Vuetify v-img and VImg without alt (#234)

SoufianeDev3426f7ccb704
diff --git a/skills/unslop-anything/reference/web.md b/skills/unslop-anything/reference/web.md
index 74c7485..70f1e90 100644
--- a/skills/unslop-anything/reference/web.md
+++ b/skills/unslop-anything/reference/web.md
@@ -20,7 +20,7 @@ These break the web for real people. They are Critical or Noticeable, whatever t
- **Real controls.** Actions are `<button>`, navigation is `<a href>`. A `div` or `span` with a click handler is unreachable by keyboard and silent to screen readers [`clickable-div`].
- **Visible focus.** Every interactive element shows a `:focus-visible` style, in the palette, instantly. `outline: none` with nothing in its place locks keyboard users out [`focus-removed`].
- **Zoom stays on.** No `maximum-scale=1` or `user-scalable=no` [`zoom-disabled`]. Inputs at 16px stop iOS from zooming on focus.
-- **Text alternatives.** Every content image has alt text; decoration has `alt=""` [`img-no-alt`].
+- **Text alternatives.** Every content image has alt text, including framework image components such as `<Image>`, `<NuxtImg>` and Vuetify's `<v-img>` / `<VImg>`; decoration has `alt=""` [`img-no-alt`].
- **URLs mean something.** The back button returns to the previous view. Filters, tabs, search, and pagination that someone would share live in the URL. Opening in a new tab works.
- **Contrast** 4.5:1 for body text and 3:1 for large text and meaningful icons, in light and dark.
- **Reduced motion.** Every animation has a `prefers-reduced-motion: reduce` fallback. Content is visible without it [`reduced-motion`].
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index 9080a5f..c6c8394 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1442,7 +1442,8 @@ const rules = [
find({ code, stack }) {
const hits = [];
// Nuxt Image renders <NuxtImg> / <NuxtPicture>, also written kebab-case (#203).
- for (const m of matches(/<(?:img|Image|NuxtImg|NuxtPicture|nuxt-img|nuxt-picture)(?=[\s/>])/, code)) {
+ // Vuetify renders <v-img> / <VImg> as an <img> too (#229).
+ for (const m of matches(/<(?:img|Image|NuxtImg|NuxtPicture|nuxt-img|nuxt-picture|v-img|VImg)(?=[\s/>])/, code)) {
const end = tagEnd(code, m.index);
const tag = code.slice(m.index, end === -1 ? undefined : end);
if (tag.startsWith("<Image") && !/\ssrc\s*=/.test(tag)) continue;
diff --git a/test/detect.test.js b/test/detect.test.js
index bcec4a2..834eff2 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -1299,6 +1299,16 @@ test("img-no-alt flags Nuxt Image's NuxtImg and NuxtPicture without alt, also ke
assert.deepStrictEqual(altLines('<nuxt-img :src="photo.url" :alt="photo.caption" />\n'), []);
});
+test("img-no-alt flags Vuetify's v-img and VImg without alt", () => {
+ const altLines = (src) => scanSource(src, "Hero.vue", { kind: "web" }).filter((f) => f.rule === "img-no-alt").map((f) => f.line);
+ // Issue #229: the repro.
+ assert.deepStrictEqual(altLines('<template>\n <v-img src="/hero.png" />\n <VImg src="/team.png" />\n</template>\n'), [2, 3]);
+ assert.deepStrictEqual(altLines('<v-img src="/hero.png" alt="Team photo" />\n'), []);
+ assert.deepStrictEqual(altLines('<VImg src="/divider.png" alt="" />\n'), []);
+ assert.deepStrictEqual(altLines('<v-img :src="photo.url" :alt="photo.caption" />\n'), []);
+ assert.deepStrictEqual(altLines('<v-img-gallery src="/hero.png" />\n'), []);
+});
+
test("placeholder-label flags inputs that use a placeholder as their only label", () => {
const rulesFor = (src) => scanSource(src, "a.tsx").map((f) => f.rule);
// The issue's repro.