react/forbid-prop-types
eslint-plugin-react
No autofix
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/forbid-prop-types": "error",
},
},
];var Component = createReactClass({
propTypes: {
a: PropTypes.any,
r: PropTypes.array,
o: PropTypes.object
},
...
});
class Component extends React.Component {
...
}
Component.propTypes = {
a: PropTypes.any,
r: PropTypes.array,
o: PropTypes.object
};
class Component extends React.Component {
static propTypes = {
a: PropTypes.any,
r: PropTypes.array,
o: PropTypes.object
}
render() {
return <div />;
}
}The documentation shows no correct example for this rule.
Examples from the ESLint documentation.
react/forbid-prop-types
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/forbid-prop-types": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce consistent usage of destructuring assignment of props, state, and context
Enforce closing bracket location in JSX
Enforce all defaultProps have a corresponding non-required PropType
Enforce closing tag location for multiline JSX
Enforce consistent linebreaks in curly braces in JSX attributes and expressions
Enforce class component state initialization style