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

no-unknown-property doesn't prevent use of unknown properties? #757

Closed
ryb73 opened this issue Aug 10, 2016 · 7 comments · Fixed by #3377
Closed

no-unknown-property doesn't prevent use of unknown properties? #757

ryb73 opened this issue Aug 10, 2016 · 7 comments · Fixed by #3377

Comments

@ryb73
Copy link

ryb73 commented Aug 10, 2016

Today React gave me an "unknown prop" warning:

image
In this example, I gave my div element an abc attribute, which is obviously invalid HTML.

I was surprised that my linter didn't pick up on this. Looking at the documentation, the name and description of the no-unknown-property rule lead me to believe that this should be caught, but that doesn't appear to be the case.

So, I suppose this is a feature request: add a rule to catch invalid DOM properties.

@ljharb
Copy link
Member

ljharb commented Aug 10, 2016

Were you using spread props, or was it an explicit prop directly on a DOM element?

@ryb73
Copy link
Author

ryb73 commented Aug 10, 2016

It was explicit.

@ljharb
Copy link
Member

ljharb commented Aug 10, 2016

I definitely think no-unknown-property should be erroring out on all the same DOM element props that React 15.3 now does.

@mvirbicianskas
Copy link

was this fixed at some point? I can confirm it doesn't work as expected :/

@ljharb
Copy link
Member

ljharb commented Jan 23, 2020

@mvirbicianskas no, but a PR would be welcome.

@sjarva
Copy link
Contributor

sjarva commented Aug 31, 2022

Phew. This issue looked like "nice and small", but well, was more detective work than I expected 😅

If anyone has more use cases than <div abc="foo" />, feel free to read through and comment on the PR #3377

@ryb73
Copy link
Author

ryb73 commented Aug 31, 2022

That's awesome, thanks @sjarva!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants