eslint-plugin-react-rsc

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

ESLint plugin providing React Server Component (RSC) related lint rules from the eslint-react project. The current stable version is v4.2.3. The plugin requires ESLint ^10.0.0 and Node.js >=20.19.0, and ships TypeScript type declarations. It is part of the @eslint-react monorepo, which has active beta development with frequent releases. Differentiators: focused purely on RSC patterns, part of a larger eslint-react ecosystem, and written in TypeScript with full type support.

error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/eslint-plugin-react-rsc/index.js not supported.
cause CommonJS require() used on an ESM-only package.
fix
Switch to import syntax: import eslintPluginReactRsc from 'eslint-plugin-react-rsc'
error Error: Cannot find module 'eslint-plugin-react-rsc'
cause Peer dependency eslint not installed or incorrect version.
fix
Run npm install eslint@^10.0.0
error TypeError: Cannot read properties of undefined (reading 'recommended')
cause Attempting to destructure 'recommended' directly from import instead of accessing via configs object.
fix
Use configs.recommended or configs['recommended'].
breaking Package is ESM-only since v4.0.0. CommonJS require() will fail.
fix Use import syntax or dynamic import; ensure 'type': 'module' in package.json.
breaking Requires ESLint ^10.0.0 as a peer dependency. Older ESLint versions are incompatible.
fix Upgrade ESLint to version 10 or later.
breaking Requires Node.js >=20.19.0.
fix Upgrade Node.js to version 20.19.0 or later.
gotcha TypeScript is an optional peer dependency, but type-checked rules require it. Missing TypeScript will cause runtime errors on those rules.
fix Install TypeScript as a dev dependency if using type-aware rules.
deprecated Some rule names may change in v5 (beta). The stable v4 API should be used for now.
fix Pin to v4.x for production.
npm install eslint-plugin-react-rsc
yarn add eslint-plugin-react-rsc
pnpm add eslint-plugin-react-rsc

Basic setup of eslint-plugin-react-rsc in an ESLint flat config, enabling three core RSC rules.

// eslint.config.js
import eslintPluginReactRsc from 'eslint-plugin-react-rsc'

export default [
  {
    plugins: {
      'react-rsc': eslintPluginReactRsc
    },
    rules: {
      'react-rsc/no-server-import': 'error',
      'react-rsc/no-client-import': 'error',
      'react-rsc/no-unsafe-component': 'error'
    }
  }
]