Skip to content

gate-31 img-alt matches an <img> written inside a JSDoc comment in the <script> block — false RED (same family as #184 / #191) #220

Description

@rubenvdlinde

Measured on ConductionNL/launchpad @ development, hydra-gates at main (756fe89), full tree.

[gate-31] img-alt: FAIL — 1 <img> tag(s) without alt attribute
  src/components/OrgNavigationItem.vue: <img>

There is no <img> in that component. The file's only occurrence of the string is inside a JSDoc comment in the <script> block:

$ grep -n '<img' src/components/OrgNavigationItem.vue
83: * resolves any value the icon picker emits — a URL (→ `<img>`), an SVG

$ grep -n '^<template>\|^</template>\|^<script>\|^</script>' src/components/OrgNavigationItem.vue
6:<template>
62:</template>
64:<script>
216:</script>

Line 83 is inside <script> (64–216), in a docblock explaining that CnDashboardIcon resolves a URL to an <img>. It is prose about markup, in backticks, in a comment, in the wrong SFC block entirely. The template contains no <img> at all.

This is the third instance of the same family:

The family is worth naming: a checker that greps raw file text for markup fails in both directions at once — it misses the real thing when it is written differently, and it fires on any mention of it in prose.

Suggested direction

gate-31 should scan the <template> block only, with comments stripped, the same way check_apphost_autoload_prelude.py now calls strip_comments() before matching. Two cheap guards, both testable:

  1. Slice the SFC to its <template> region before matching — nothing in <script> or <style> can render an <img>.
  2. Strip <!-- … -->, // and /* … */ comments, and inline-code spans, before matching.

A fixture that would have caught it: a .vue file whose <script> docblock contains `<img>` and whose template contains none — must report 0. Paired with the positive control (a real <img> with no alt in the template — must report 1), so the relaxation cannot be over-applied.

src/components/OrgNavigationItem.vue at launchpad development is a clean reproduction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions