Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mikecat opened this issue Jan 30, 2025 · 1 comment
Open

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

mikecat opened this issue Jan 30, 2025 · 1 comment
Labels
Linting Related to `next lint` or ESLint with Next.js.

Comments

@mikecat
Copy link

mikecat commented Jan 30, 2025

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

@github-actions github-actions bot added the Linting Related to `next lint` or ESLint with Next.js. label Jan 30, 2025
@samcx
Copy link
Member

samcx commented Jan 30, 2025

@mikecat Thank you for submitting an issue!

I can indeed confirm this. We'll be adding this internally!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linting Related to `next lint` or ESLint with Next.js.
Projects
None yet
Development

No branches or pull requests

2 participants