Migrating from eslint-plugin-react
Complete guide for migrating from eslint-plugin-react to ESLint React
This page is a work in progress and may be incomplete.
This guide provides a comprehensive comparison between eslint-plugin-react
and ESLint React rules to help you migrate your existing configuration.
Overview
ESLint React is designed as a modern replacement for eslint-plugin-react
with improved performance, better TypeScript support, and more accurate rule implementations.
However, not all rules have direct equivalents, and some behave differently.
Rule Comparison Table
Legend
- 🔧 Fully supported - Rule is supported, and has an auto-fix
- ✅ Mostly supported - Rule is supported but doesn't have an auto-fix
- 🟡 Partial support - Similar but not identical functionality
- ❌ Not supported - No equivalent rule
- ➡️ External plugin - Rule is available in another ESLint plugin
- 🚫 Legacy - Rule is not applicable in modern React development (e.g. class-based components,
propTypes
) - ⚠️ Warning - Rule has been deprecated in
eslint-plugin-react
A variety of rules are marked legacy, but still have equivalent rules. This distinction was done to more accurately assess
migration for React written with function components and no longer use propTypes
.
Table
The following table compares all rules from eslint-plugin-react
with their ESLint React (or external) equivalents:
ESLint React Column
- Rule names link to ESLint React documentation
- Multiple rules separated by
/
indicate alternative approaches - Rules with
+
indicate multiple rules that together provide equivalent functionality
Gradual Migration
You can migrate gradually by using both plugins together, using the disableConflictEslintPluginReact
ruleset:
import reactPlugin from "eslint-plugin-react";
import eslintReact from "@eslint-react/eslint-plugin";
export default [
// Start with the eslint-plugin-react
{
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
// Whatever config you had enabled with eslint-plugin-react
...reactPlugin.configs.flat.recommended,
// Now disable all conflicting rules
...eslintReact.configs['disable-conflict-eslint-plugin-react],
// Now enable the desired rules
...eslintReact.configs.recommended,
}
];