eslint-plugin-react-dom

raw JSON →
4.2.3 verified Sat Apr 25 auth: no javascript

An ESLint plugin for React DOM-specific linting rules, part of the @eslint-react monorepo. Current stable version is 4.2.3, requiring Node >=22.0.0 and ESLint ^10.0.0. It provides rules for DOM-related best practices in React applications. The package ships with TypeScript types. Note that the latest releases are in v5 beta (5.5.1-beta.0) with breaking changes on the v5 track. Key differentiator: focused solely on DOM rules, unlike broader React ESLint plugins. Release cadence is active with frequent beta updates.

error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
cause Using CommonJS require() on an ESM-only package.
fix
Change to import statement or use dynamic import().
error Failed to load plugin 'react-dom': Package requires eslint ^10.0.0
cause Installed ESLint version is lower than 10.
fix
Upgrade ESLint to ^10.0.0.
error TypeError: Cannot read properties of undefined (reading 'no-dangerously-set-innerhtml')
cause Plugin not registered properly in flat config.
fix
Add plugin to plugins object: plugins: { 'react-dom': pluginReactDom }.
breaking Node >=22.0.0 required; plugin will not load on older versions.
fix Update Node to v22+ or stay on plugin v3.x if using older Node.
breaking ESLint ^10.0.0 required; flat config only.
fix Use ESLint 10+ with flat config (eslint.config.js).
breaking ESM-only package; require() will throw ERR_REQUIRE_ESM.
fix Convert project to ESM or use dynamic import() instead of require().
deprecated v5 series is in beta with breaking changes; v4 is still stable.
fix Pin to v4 for stable rules; v5 may have renamed or removed rules.
gotcha Rules may require type information; not all work without TypeScript.
fix Ensure TypeScript is installed and parser configured for type-aware rules.
npm install eslint-plugin-react-dom
yarn add eslint-plugin-react-dom
pnpm add eslint-plugin-react-dom

Configures the plugin with two DOM-specific rules in an ESLint flat config file.

// eslint.config.js
import pluginReactDom from 'eslint-plugin-react-dom';

export default [
  {
    plugins: {
      'react-dom': pluginReactDom,
    },
    rules: {
      'react-dom/no-dangerously-set-innerhtml': 'error',
      'react-dom/no-missing-iframe-sandbox': 'warn',
    },
  },
];