[Bug] broken-image still fires on `<img>` inside a JSX line comment in some valid .tsx files (engine 0.1.6)
What happened?
broken-image reports an <img> that only appears in a // comment inside a JSX expression. This looks like #486 / #771, which were closed as fixed, but it still reproduces on engine 0.1.6 (the latest engine release).
Whether it fires depends on the rest of the file. The repro below triggers it. Removing either the <dt> or the <dd> line makes the finding go away. Swapping the fragment and dt/dd for div/span still triggers it. Appending <p>x</p> to the <dd> line also clears it. The comment is also the only cause: rewording it to // Plain img tag: … clears the finding in every variant.
Steps to reproduce
- Save as
repro.tsx:
function Row({ label, value }: { label: string; value: string }) {
return (
<>
<dt>{label}</dt>
<dd>{value}</dd>
</>
);
}
function Thumb({ url }: { url?: string }) {
return (
<div>
{url ? (
// Plain <img>: presigned thumbnail URL
<img src={url} alt="" />
) : null}
</div>
);
}- Run
impeccable detect --json --no-config repro.tsx - Output:
[
{
"antipattern": "broken-image",
"severity": "warning",
"category": "quality",
"line": 14,
"snippet": "<img>"
}
]Expected behavior
No finding. Line 14 is a comment, and the real <img> on line 15 has a src.
Provider & environment
- Provider: Claude Code (the Codex hook also reproduces it through
impeccable.cmd) - Provider version: Claude Code 2.1.281
- Impeccable: skill 4.4.0 from
main@ 9d715cc, engine 0.1.6 (from theengine-v0.1.6release, sha256 verified by the launcher) - OS: Windows 11 (Git Bash launcher)
Additional context
- I found it in a real Next.js page where the hook re-reported the finding after every edit to that file. I've suppressed it with a file-scoped
ignore-value broken-image "*" --file …for now. - The file is LF and ASCII.
- Several other
.tsxfiles in the same app use the same{cond ? (<img src={x} />) : …}pattern without the comment and don't trigger it. Simpler single-component versions of this repro don't trigger it either, so the comment stripping seems to apply only some of the time.
Willing to work on a fix?
No, but happy to test a fix.
Drafted with Claude Code; the repro and outputs above were run locally.
Source: pbakaus/impeccable