lint-mdx.js: false-positive missing-alt warning for multi-line <img> tags

Open Beginner friendly
#1,792 0 comments 0 reactions 0 assignees View on GitHub

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

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from base/docs

All issues in base/docs

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.