roginfarrer / eslint-plugin-react-server-components

ESLint rule for enforcing "use client" in React client components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eslint-plugin-react-server-components

Experiment in making an ESLint rule for enforcing "use client" in client components (and warning if it's not needed).

Installation

npm install --save-dev eslint-plugin-react-server-components

Configuration

To use the recommended configuration:

// eslintrc.json
{
  extends: ["plugin:react-server-components/recommended"],
}

Rules

use-client

Enforce components are appropriately prefixed with 'use client'.

{
  "rules": {
    "react-server-components/use-client": "error"
  }
}

About

ESLint rule for enforcing "use client" in React client components

License:MIT License


Languages

Language:TypeScript 68.5%Language:CSS 19.5%Language:JavaScript 12.0%