lint-mdx.js: false-positive missing-alt warning for multi-line <img> tags
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- javascript, node.js
- Domain
- documentation, tooling
Research direction
Start in scripts/lint-mdx.js at checkMintlifyComponents and compare the img check with the adjacent Frame-wrapping lookback pattern. Run node scripts/lint-mdx.js all against the five documented locations, then verify that multiline img tags with alt attributes stop warning while genuine missing-alt and synthetic cases remain caught.
Written by the indexing model from the issue text.
Description
Description
The alt-attribute check in scripts/lint-mdx.js (inside checkMintlifyComponents) only inspects the single line containing <img. When an tag's attributes are spread across multiple lines (a common JSX style used throughout docs/), an alt= attribute on a later line is never seen, and the linter reports a false-positive "should have alt attribute" warning.
Evidence
Running node scripts/lint-mdx.js all on current master reports 5 such warnings, all false positives - each file already has a valid alt:
- docs/base-account/improve-ux/sponsor-gas/paymasters.mdx:33 and :57
- docs/base-account/reference/ui-elements/brand-guidelines.mdx:128 and :156
- docs/snippets/BasePayButton.mdx:21
Example from paymasters.mdx - the img tag spans multiple lines with alt="Paymaster CDP" set on its own line, not on the same line as the opening <img, so the single-line check misses it.
Fix
Companion PR makes the check accumulate lines starting at until the tag closes, matching the multi-line lookback pattern already used by the adjacent Frame-wrapping check in the same function. Verified against synthetic missing-alt and multi-line-with-alt cases to confirm real violations are still caught.
- Dominant language
- JavaScript
- Stars
- 337
- Forks
- 798
- Avg merge
- 7h 24m
- Merged PRs (30d)
- 51
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from base/docs
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·