react/forbid-dom-props
eslint-plugin-react
No autofix
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/forbid-dom-props": "error",
},
},
];// [1, { "forbid": ["id"] }]
<div id='Joe' />// [1, { "forbid": ["style"] }]
<div style={{color: 'red'}} />// [1, { "forbid": ["id"] }]
<Hello id='foo' />// [1, { "forbid": ["id"] }]
<Hello id={{color: 'red'}} />Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
react/forbid-dom-props
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/forbid-dom-props": "error",
},
},
];react/forbid-dom-props
react plugin · restriction
{
"plugins": [
"react"
],
"rules": {
"react/forbid-dom-props": "error"
}
}Biome does not have this rule.
Require all forwardRef components include a ref parameter
Enforce using onChange or readonly attribute when checked is used
Ensure destructuring and symmetric naming of useState hook value and setter variables