react/no-unsafe
eslint-plugin-react
No autofix
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/no-unsafe": "error",
},
},
];class Foo extends React.Component {
UNSAFE_componentWillMount() {}
UNSAFE_componentWillReceiveProps() {}
UNSAFE_componentWillUpdate() {}
}const Foo = createReactClass({
UNSAFE_componentWillMount: function() {},
UNSAFE_componentWillReceiveProps: function() {},
UNSAFE_componentWillUpdate: function() {}
});class Foo extends Bar {
UNSAFE_componentWillMount() {}
UNSAFE_componentWillReceiveProps() {}
UNSAFE_componentWillUpdate() {}
}const Foo = bar({
UNSAFE_componentWillMount: function() {},
UNSAFE_componentWillReceiveProps: function() {},
UNSAFE_componentWillUpdate: function() {}
});Examples from the ESLint documentation.
react/no-unsafe
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/no-unsafe": "error",
},
},
];react/no-unsafe
react plugin · correctness
{
"plugins": [
"react"
],
"rules": {
"react/no-unsafe": "error"
}
}Biome does not have this rule.
Enforce using onChange or readonly attribute when checked is used
Disallow usage of setState in componentDidMount
Require all forwardRef components include a ref parameter