no-deprecated
Warn about using deprecated React APIs. This rule is part of eslint-plugin-react-features and provides LLM-optimized error messages.
Warn about using deprecated React APIs. This rule is part of eslint-plugin-react-features and provides LLM-optimized error messages.
Quick Summary
| Aspect | Details |
|---|---|
| Severity | Warning (code quality) |
| Auto-Fix | ❌ No auto-fix |
| Category | React |
| ESLint MCP | ✅ Optimized for ESLint MCP integration |
| Best For | All React/JSX projects |
Rule Details
Deprecated APIs will be removed in future React versions. Update to modern alternatives.
Reported, however the module is named (a named or renamed import, a default or namespace import, require, or the UMD globals React / ReactDOM):
- react-dom's
render,hydrate,unmountComponentAtNodeandfindDOMNode(deprecated in React 18, removed in 19); - react's
createClassandPropTypes(removed in React 16); - the lifecycle methods
componentWillMount,componentWillReceiveProps,componentWillUpdateand theirUNSAFE_forms, on a class that extends React'sComponent/PureComponent(a method, an arrow property or a quoted key).
Not reported: the same names on a local object or function, imported from another module, or declared on a class that is not a React component; a bare render(…) the file never imports.
Examples
❌ Incorrect
import React from 'react';
class MyComponent extends React.Component {
componentWillMount() {
// Deprecated
this.loadData();
}
componentWillReceiveProps(nextProps) {
// Deprecated
this.setState({ data: nextProps.data });
}
}✅ Correct
import React, { useEffect, useState } from 'react';
function MyComponent({ data }) {
const [localData, setLocalData] = useState(data);
useEffect(() => {
loadData();
}, []);
useEffect(() => {
setLocalData(data);
}, [data]);
}Related Rules
no-unsafe- Warn about UNSAFE_ lifecycle methods
Use this rule
npm install -D oxlint-plugin-react-features{ "jsPlugins": ["oxlint-plugin-react-features"], "rules": { "react-features/no-deprecated": "error" }}import { defineConfig } from 'vite-plus';export default defineConfig({ lint: { jsPlugins: ['oxlint-plugin-react-features'], rules: { 'react-features/no-deprecated': 'error', }, },});oxlint-plugin-react-features re-exports eslint-plugin-react-features/oxlint: the same rules under the same IDs, and no ESLint install. Why oxlint.
Did this rule catch something? Star the repo to get new CWE coverage as we ship it — or follow the AI-code-security benchmarks behind these rules.