eslint-plugin-react-19-upgrade
raw JSON → 1.9.0 verified Sat Apr 25 auth: no javascript
An ESLint plugin to identify and fix breaking changes when upgrading React 18 to React 19. Current version 1.9.0, actively maintained with frequent releases. It provides rules covering deprecated patterns like defaultProps, propTypes, legacy context, string refs, factories, removed react-dom APIs, and test-utils.act. Differentiators: focused solely on React 18→19 migration, fixable rules, and compatibility with ESLint >=7. Not a general React linter, but a targeted upgrade helper.
Common errors
error Error: Failed to load plugin 'react-19-upgrade' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-react-19-upgrade' ↓
cause Missing installation or wrong ESLint version (requires >=7.0.0).
fix
Run
npm install eslint-plugin-react-19-upgrade --save-dev and ensure ESLint >=7. error Definition for rule 'no-default-props' was not found. ↓
cause Rule name missing plugin prefix.
fix
Use
react-19-upgrade/no-default-props instead of no-default-props in rules config. error TypeError: Cannot read properties of undefined (reading 'some') ↓
cause The plugin internally expects a certain AST structure; may occur with non-React code or TypeScript without @typescript-eslint parser.
fix
Ensure the parser is set to @typescript-eslint/parser for TypeScript files and target only React components.
Warnings
gotcha The plugin does not lint for `element.ref` access change (ref becomes a prop). Use the official React codemod: `npx codemod@latest react/19/replace-ref-access` ↓
fix Use the codemod instead; no plugin rule available.
deprecated rule `no-legacy-react-dom` will flag `ReactDOM.render` and `ReactDOM.hydrate`; they are removed in React 19. ↓
fix Use `createRoot` from `react-dom/client`.
deprecated rule `no-legacy-react-dom-server` flags `renderToNodeStream` and `renderToStaticNodeStream`; removed in React 19. ↓
fix Use `renderToPipeableStream` (different API).
deprecated rule `no-legacy-test-utils-act` flags `act` from `react-dom/test-utils`; removed in React 19. ↓
fix Import `act` from `react`.
gotcha rule `no-default-props` fixable by ESLint but may not cover all edge cases (e.g., forwardRef components). ↓
fix Review auto-fixed code manually for complex components.
Install
npm install eslint-plugin-react-19-upgrade yarn add eslint-plugin-react-19-upgrade pnpm add eslint-plugin-react-19-upgrade Imports
- plugin (default) wrong
const react19Upgrade = require('eslint-plugin-react-19-upgrade');correctimport react19Upgrade from 'eslint-plugin-react-19-upgrade'; - react-19-upgrade (plugin name in config) wrong
"plugins": ["eslint-plugin-react-19-upgrade"]correct"plugins": ["react-19-upgrade"] - rules (config) wrong
"rules": { "no-default-props": "error" }correct"rules": { "react-19-upgrade/no-default-props": "error" }
Quickstart
// .eslintrc.json
{
"plugins": ["react-19-upgrade"],
"rules": {
"react-19-upgrade/no-default-props": "error",
"react-19-upgrade/no-prop-types": "warn",
"react-19-upgrade/no-legacy-context": "error",
"react-19-upgrade/no-string-refs": "error",
"react-19-upgrade/no-factories": "error",
"react-19-upgrade/no-legacy-react-dom": "error",
"react-19-upgrade/no-legacy-react-dom-server": "error",
"react-19-upgrade/no-legacy-test-utils-act": "error"
}
}