react/require-optimization
eslint-plugin-react
No autofix
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/require-optimization": "error",
},
},
];class YourComponent extends React.Component {
}createReactClass({
});class YourComponent extends React.Component {
shouldComponentUpdate () {
return false;
}
}createReactClass({
shouldComponentUpdate: function () {
return false;
}
});createReactClass({
mixins: [PureRenderMixin]
});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/require-optimization
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/require-optimization": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow adjacent inline elements not separated by whitespace.
Require or prevent a new line after jsx elements and expressions.