Skip to main content
ESLint Interlace
Plugin: react-featuresRules

no-deprecated

Warn about using deprecated React APIs. This rule is part of eslint-plugin-react-features and provides LLM-optimized error messages.

Keywords: React, deprecated, API, migration, ESLint rule, code quality, LLM-optimized

Warn about using deprecated React APIs. This rule is part of eslint-plugin-react-features and provides LLM-optimized error messages.

Quick Summary

AspectDetails
SeverityWarning (code quality)
Auto-Fix❌ No auto-fix
CategoryReact
ESLint MCP✅ Optimized for ESLint MCP integration
Best ForAll React/JSX projects

Rule Details

Deprecated APIs will be removed in future React versions. Update to modern alternatives.

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]);
}
  • no-unsafe - Warn about UNSAFE_ lifecycle methods