JSPM

eslint-plugin-react-hooks-extra

2.5.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 353135
  • Score
    100M100P100Q192040F
  • License MIT

ESLint React's ESLint plugin for React Hooks related rules.

Package Exports

  • eslint-plugin-react-hooks-extra
  • eslint-plugin-react-hooks-extra/package.json

Readme

eslint-plugin-react-hooks-extra

Extra rules for React Hooks.

Install

# npm
npm install --save-dev eslint-plugin-react-hooks-extra

Setup

// eslint.config.js

// @ts-check
import js from "@eslint/js";
import reactHooksExtra from "eslint-plugin-react-hooks-extra";
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";

export default defineConfig(
  {
    files: ["**/*.ts", "**/*.tsx"],
    extends: [
      js.configs.recommended,
      tseslint.configs.recommended,
      reactHooksExtra.configs.recommended,
    ],
    languageOptions: {
      parser: tseslint.parser,
      parserOptions: {
        projectService: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
    rules: {
      // Put rules you want to override here
      "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
    },
  },
);

Rules

https://eslint-react.xyz/docs/rules/overview#hooks-extra-rules