react/display-name
eslint-plugin-react
No autofixRecommended
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/display-name": "error",
},
},
];var Hello = createReactClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
const Hello = React.memo(({ a }) => {
return <>{a}</>
})
export default ({ a }) => {
return <>{a}</>
}var Hello = createReactClass({
displayName: 'Hello',
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
const Hello = React.memo(function Hello({ a }) {
return <>{a}</>
})Examples from the ESLint documentation.
react/display-name
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/display-name": "error",
},
},
];react/display-name
react plugin · pedantic
{
"plugins": [
"react"
],
"rules": {
"react/display-name": "error"
}
}Biome does not have this rule.
Disallow target="_blank" attribute without rel="noreferrer"
Disallow unescaped HTML entities from appearing in markup
Disallow direct mutation of this.state
Disallow variables used in JSX to be incorrectly marked as unused