ESLint Plugin for Extra React Hooks Rules

2.13.0 · active · verified Tue Apr 21

`eslint-plugin-react-hooks-extra` version `2.13.0` offers supplementary ESLint rules for React Hooks, designed to enforce advanced best practices and identify common pitfalls beyond the fundamental "Rules of Hooks" provided by the official `eslint-plugin-react-hooks`. This plugin is part of the larger `eslint-react` ecosystem, which actively maintains and develops its suite of linting tools, with recent beta releases for its `v5` major version (e.g., `v5.3.2-beta.0`). Although `eslint-plugin-react-hooks-extra` currently remains at `2.13.0`, it operates within an environment compatible with the `eslint-react` project's latest requirements. Its primary differentiator is providing "extra" or more opinionated rules that complement, rather than replace, existing React linting configurations, allowing developers to incrementally enhance their React Hooks linting strictness.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates setting up `eslint-plugin-react-hooks-extra` using ESLint Flat Config (`eslint.config.js`) with TypeScript, extending recommended configurations and showing an example of individual rule customization.

import js from "@eslint/js";
import hooksExtra 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,
    // Add configs from eslint-plugin-react-hooks-extra
    hooksExtra.configs.recommended,
  ],
  rules: {
    // Example: Override or add individual rules
    "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
    "react-hooks-extra/no-redundant-useState": "error" 
  },
});

view raw JSON →