-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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: prevent both children and dangerouslySetInnerHTML at the same time #710
Comments
I can work on this. What should this rule be named? |
The rule needs to be all lowercase - maybe |
Since this is scoped to DOM elements, perhaps that should be part of the name? In #709 we settled on I think that the |
Ah yes, that's true, and it should catch I think |
Thinking about #712, which I think might be named |
Prevents dangerouslySetInnerHTML and children from being used at the same time
Prevents dangerouslySetInnerHTML and children from being used at the same time
Prevents dangerouslySetInnerHTML and children from being used at the same time
Prevents dangerouslySetInnerHTML and children from being used at the same time
Prevents dangerouslySetInnerHTML and children from being used at the same time
New rules: * `react/no-danger-with-children` (jsx-eslint/eslint-plugin-react#710) * `react/no-find-dom-node` (jsx-eslint/eslint-plugin-react#678) * `react/style-prop-object` (jsx-eslint/eslint-plugin-react#715)
* Update eslint-plugin-react and enable new rules New rules: * `react/no-danger-with-children` (jsx-eslint/eslint-plugin-react#710) * `react/no-find-dom-node` (jsx-eslint/eslint-plugin-react#678) * `react/style-prop-object` (jsx-eslint/eslint-plugin-react#715) * Remove react/no-find-dom-node for now
* Update eslint-plugin-react and enable new rules New rules: * `react/no-danger-with-children` (jsx-eslint/eslint-plugin-react#710) * `react/no-find-dom-node` (jsx-eslint/eslint-plugin-react#678) * `react/style-prop-object` (jsx-eslint/eslint-plugin-react#715) * Remove react/no-find-dom-node for now
* Update eslint-plugin-react and enable new rules New rules: * `react/no-danger-with-children` (jsx-eslint/eslint-plugin-react#710) * `react/no-find-dom-node` (jsx-eslint/eslint-plugin-react#678) * `react/style-prop-object` (jsx-eslint/eslint-plugin-react#715) * Remove react/no-find-dom-node for now
* Update eslint-plugin-react and enable new rules New rules: * `react/no-danger-with-children` (jsx-eslint/eslint-plugin-react#710) * `react/no-find-dom-node` (jsx-eslint/eslint-plugin-react#678) * `react/style-prop-object` (jsx-eslint/eslint-plugin-react#715) * Remove react/no-find-dom-node for now
* Update eslint-plugin-react and enable new rules New rules: * `react/no-danger-with-children` (jsx-eslint/eslint-plugin-react#710) * `react/no-find-dom-node` (jsx-eslint/eslint-plugin-react#678) * `react/style-prop-object` (jsx-eslint/eslint-plugin-react#715) * Remove react/no-find-dom-node for now
* Update eslint-plugin-react and enable new rules New rules: * `react/no-danger-with-children` (jsx-eslint/eslint-plugin-react#710) * `react/no-find-dom-node` (jsx-eslint/eslint-plugin-react#678) * `react/style-prop-object` (jsx-eslint/eslint-plugin-react#715) * Remove react/no-find-dom-node for now
React will issue a warning if you try to use dangerouslySetInnerHTML and children at the same time.
https://github.com/facebook/react/blob/85dcbf83/src/renderers/dom/shared/ReactDOMComponent.js#L170
This should be easy enough to enforce for most cases with a linter rule.
Bad:
Good:
The text was updated successfully, but these errors were encountered: