react/no-deprecated
eslint-plugin-react
No autofixRecommended
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/no-deprecated": "error",
},
},
];React.render(<MyComponent />, root);
React.unmountComponentAtNode(root);
React.findDOMNode(this.refs.foo);
React.renderToString(<MyComponent />);
React.renderToStaticMarkup(<MyComponent />);
React.createClass({ /* Class object */ });
const propTypes = {
foo: PropTypes.bar,
};
//Any factories under React.DOM
React.DOM.div();
import React, { PropTypes } from 'react';
// old lifecycles (since React 16.9)
componentWillMount() { }
componentWillReceiveProps() { }
componentWillUpdate() { }
// React 18 deprecations
import { render } from 'react-dom';
ReactDOM.render(<div></div>, container);
import { hydrate } from 'react-dom';
ReactDOM.hydrate(<div></div>, container);
// …// when React < 18
ReactDOM.render(<MyComponent />, root);
// when React is < 0.14
ReactDOM.findDOMNode(this.refs.foo);
import { PropTypes } from 'prop-types';
UNSAFE_componentWillMount() { }
UNSAFE_componentWillReceiveProps() { }
UNSAFE_componentWillUpdate() { }
ReactDOM.createPortal(child, container);
import { createRoot } from 'react-dom/client';
const root = createRoot(container);
root.unmount();
import { hydrateRoot } from 'react-dom/client';
const root = hydrateRoot(container, <App/>);Examples from the ESLint documentation.
react/no-deprecated
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/no-deprecated": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow using code marked as @deprecated
Forbid imported names marked with @deprecated documentation tag.
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