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

Don't report @next/next/no-img-element when inside a <Picture> element #37504

Closed
1 task done
votemike opened this issue Jun 7, 2022 · 4 comments
Closed
1 task done
Labels
good first issue Easy to fix issues, good for newcomers Image (next/image) Related to Next.js Image Optimization. Linting Related to `next lint` or ESLint with Next.js.

Comments

@votemike
Copy link

votemike commented Jun 7, 2022

Verify canary release

  • I verified that the issue exists in Next.js canary release

Provide environment information

What browser are you using? (if relevant)

How are you deploying your application? (if relevant)

Describe the Bug

Linting throws a warning of @next/next/no-img-element when an <img> tag is inside a <picture> tag.
<Image> cannot do all the things that <picture> can and so using the <img> is a legitimate use-case.
Therefore this warning should not be thrown.

Expected Behavior

Linting ignores <img> tags inside <picture> tags.

To Reproduce

Add an <img> tag inside a <picture> tag and run linting.

@votemike votemike added the bug Issue was opened via the bug report template. label Jun 7, 2022
@balazsorban44 balazsorban44 added good first issue Easy to fix issues, good for newcomers Image (next/image) Related to Next.js Image Optimization. Linting Related to `next lint` or ESLint with Next.js. and removed bug Issue was opened via the bug report template. labels Jun 7, 2022
@balazsorban44
Copy link
Member

Thanks, sounds like a change is needed in this ESLint rule:

https://github.com/vercel/next.js/blob/canary/packages/eslint-plugin-next/lib/rules/no-img-element.js

And adding a test use-case in this folder to verify it works correctly:

https://github.com/vercel/next.js/tree/canary/test/integration/eslint

@andreistefanwork
Copy link
Contributor

Hi! Can I pick up this issue? Or @votemike were you planning to do it?

@votemike
Copy link
Author

votemike commented Jun 7, 2022

@andreistefanwork go for it!

andreistefanwork added a commit to andreistefanwork/next.js that referenced this issue Jun 8, 2022
andreistefanwork added a commit to andreistefanwork/next.js that referenced this issue Jun 8, 2022
andreistefanwork added a commit to andreistefanwork/next.js that referenced this issue Jun 8, 2022
andreistefanwork added a commit to andreistefanwork/next.js that referenced this issue Jun 8, 2022
andreistefanwork added a commit to andreistefanwork/next.js that referenced this issue Jun 9, 2022
andreistefanwork added a commit to andreistefanwork/next.js that referenced this issue Jun 9, 2022
andreistefanwork added a commit to andreistefanwork/next.js that referenced this issue Jun 15, 2022
andreistefanwork added a commit to andreistefanwork/next.js that referenced this issue Jun 15, 2022
andreistefanwork added a commit to andreistefanwork/next.js that referenced this issue Jun 15, 2022
ijjk added a commit that referenced this issue Jun 16, 2022
* fix(eslint): allow <img> in conjunction with <picture> (#37504)

* Apply suggestions from code review

* add space

Co-authored-by: JJ Kasper <jj@jjsweb.site>
@ijjk ijjk closed this as completed Jun 16, 2022
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Easy to fix issues, good for newcomers Image (next/image) Related to Next.js Image Optimization. Linting Related to `next lint` or ESLint with Next.js.
Projects
None yet
Development

No branches or pull requests

4 participants