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

Rule proposal: forbid innerHTML prop on DOM element tags #712

Open
lencioni opened this issue Jul 26, 2016 · 1 comment
Open

Rule proposal: forbid innerHTML prop on DOM element tags #712

lencioni opened this issue Jul 26, 2016 · 1 comment

Comments

@lencioni
Copy link
Collaborator

React will issue a warning in dev if you try to use pass innerHTML prop to a DOM element tag.

https://github.com/facebook/react/blob/85dcbf83/src/renderers/dom/shared/ReactDOMComponent.js#L182-L184

This should be easy enough to enforce for most cases with a linter rule.

Bad:

<div innerHTML='HTML' />

Good:

<div dangerouslySetInnerHTML={{ __html: 'HTML' }} />
@lencioni
Copy link
Collaborator Author

lencioni commented Jul 26, 2016

Name: dom-elements-no-inner-html?

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

No branches or pull requests

2 participants