vercel / vercel/next.js

ESLint false-positive on "Image" components from another library

Open
#75,482 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Linting
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/mikecat/next-image-false-positive-example

To Reproduce
  1. Clone the repository
  2. Set the working directory to the root of the repository
  3. Install packages used: npm install
  4. Run lint: npx next lint
Current vs. Expected behavior

npx next lint outputs this warning for lucide-react's Image component:

./app/page.tsx
6:7  Warning: Image elements must have an alt prop, either with meaningful text, or an empty string for decorative images.  jsx-a11y/alt-text

The Images component is not warned, so this looks like the linter is confusing the Image element with Next.js's Image component instead of warning about usage of SVG image (inside the components).

I think the warnings should only be emited on Next.js's Image components (and other intended targets), not on other irrelevant components that are just named as Image.

Provide environment information
'pnpm' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home
  Available memory (MB): 32512
  Available CPU cores: 20
Binaries:
  Node: 22.13.1
  npm: 11.0.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 15.2.0-canary.33 // Latest available version is detected (15.2.0-canary.33).
  eslint-config-next: 15.1.6
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Linting

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

No response

Contributor guide

Open the contributing guide

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.

Research direction

Clone the linked reproduction repository and run npm install followed by npx next lint. Start with app/page.tsx and the eslint-config-next jsx-a11y/alt-text behavior, comparing the lucide-react Image component with Next.js's Image component. Done means lint no longer warns for the unrelated lucide-react Image while retaining the intended warning for Next.js Image usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript, nextjs, react, typescript
Domain
accessibility, frontend, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.