When I tried the config snippet in the question by @Jonathan Kasser, I got an error: TypeError: context.getSource is not a function.

The solution is to use fixupPluginRules from @eslint/compat (you need to install this), so my eslint.config.js has a separate object in the config array:

import { fixupPluginRules } from "@eslint/compat";

  // Even though eslint-plugin-react-hooks exposes configs.recommended, it is not yet compatible with the flat file config, 
  // because it has plugins: [ 'react-hooks' ] property, but plugins should be an object
  // Once it is supported, replace with: eslintPluginReactHooks.configs.recommended,
  {
    plugins: {
      "react": reactPlugin, // remove this if you already have another config object that adds the react plugin
      "react-hooks": fixupPluginRules(eslintPluginReactHooks),
    },
    rules: {
      ...eslintPluginReactHooks.configs.recommended.rules,
    },
  },

Resources

  • https://github.com/t3-oss/create-t3-turbo/issues/984#issuecomment-2210934687

Proof it works

I've confirmed this by having a code that should error, and saw the error:

  const [first, setfirst] = useState("");
  useEffect(() => {
    console.log(first);
  }, []);
8:6  warning  React Hook useEffect has a missing dependency: 'first'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
Answer from Ben Butterworth on Stack Overflow
🌐
npm
npmjs.com › package › eslint-plugin-react-hooks
eslint-plugin-react-hooks - npm
The official ESLint plugin for React which enforces the Rules of React and other best practices.
      » npm install eslint-plugin-react-hooks
    
Published   Oct 24, 2025
Version   7.0.1
Homepage   https://react.dev/
🌐
React
react.dev › reference › eslint-plugin-react-hooks
eslint-plugin-react-hooks – React
This plugin helps you catch violations of React’s rules at build time, ensuring your components and hooks follow React’s rules for correctness and performance. The lints cover both fundamental React patterns (exhaustive-deps and rules-of-hooks) and issues flagged by React Compiler. React Compiler diagnostics are automatically surfaced by this ESLint ...
Discussions

How to use eslint-plugin-react and eslint-plugin-react-hooks, just for myself?
You don't normally, because its better for the code to be consistent among developers. I would advice that you, instead aim to convince your team to install it for the project. If you still want to do it, you could install it, develop and then remove it from your package.json before commiting. And maybe create a simple script file (AI could do this for you) to do this for you. More on reddit.com
🌐 r/reactjs
7
6
January 10, 2025
Can ESLint "react-hooks/exhaustive-deps" safely be ignored with RTK dispatch?
Hi, I'm a Redux maintainer. Other comments have generally answered, but to add some additional detail: The dispatch method comes straight from the Redux store instance. In theory, that could be swapped to a different Redux store. In practice, it never will be, so it will always be the same function reference. Beyond that, the lint rule has no idea what values will actually be stable, other than React's own state setter methods. So, it assumes everything could be a changing reference, and thus that everything used in an effect must be listed in the deps array. There's no harm in adding it to the deps array, it's correct technically, and it makes the linter happy, so just go ahead and add it. More on reddit.com
🌐 r/reactjs
76
19
June 1, 2024
Is eslint-plugin-react is unnecessary if i use @typescript-eslint/eslint-plugin and eslint-plugin-react-hooks?
I believe it still does, but go look at the docs to know for sure. More on reddit.com
🌐 r/reactjs
7
3
November 30, 2023
What ESLint Plugins Do You Recommend When Using NextJs?
Here is my ESLint plugins I use for all my NextJS projects: https://github.com/ixartz/Next-js-Boilerplate/blob/main/package.json#L85-L102 There are 18 plugins. I also use ESLint plugins for testing part: Jest, Playwright, Storybook, etc. And here you can find how I configure everything: https://github.com/ixartz/Next-js-Boilerplate/blob/main/.eslintrc More on reddit.com
🌐 r/reactjs
27
14
February 20, 2024
Top answer
1 of 4
10

When I tried the config snippet in the question by @Jonathan Kasser, I got an error: TypeError: context.getSource is not a function.

The solution is to use fixupPluginRules from @eslint/compat (you need to install this), so my eslint.config.js has a separate object in the config array:

import { fixupPluginRules } from "@eslint/compat";

  // Even though eslint-plugin-react-hooks exposes configs.recommended, it is not yet compatible with the flat file config, 
  // because it has plugins: [ 'react-hooks' ] property, but plugins should be an object
  // Once it is supported, replace with: eslintPluginReactHooks.configs.recommended,
  {
    plugins: {
      "react": reactPlugin, // remove this if you already have another config object that adds the react plugin
      "react-hooks": fixupPluginRules(eslintPluginReactHooks),
    },
    rules: {
      ...eslintPluginReactHooks.configs.recommended.rules,
    },
  },

Resources

  • https://github.com/t3-oss/create-t3-turbo/issues/984#issuecomment-2210934687

Proof it works

I've confirmed this by having a code that should error, and saw the error:

  const [first, setfirst] = useState("");
  useEffect(() => {
    console.log(first);
  }, []);
8:6  warning  React Hook useEffect has a missing dependency: 'first'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
2 of 4
4

[email protected] was released a few weeks ago with "stable" eslint v9 support. If you can upgrade, then see https://github.com/facebook/react/issues/28313#issuecomment-2408157792 for a sample configuration for now.

Also, follow this thread if interested in documentation refresh

🌐
GitHub
github.com › facebook › react › tree › main › packages › eslint-plugin-react-hooks
react/packages/eslint-plugin-react-hooks at main · facebook/react
The official ESLint plugin for React which enforces the Rules of React and other best practices.
Author   facebook
🌐
npm
npmjs.com › package › eslint-plugin-react
eslint-plugin-react - npm
April 3, 2025 - Note: These configurations will import eslint-plugin-react and enable JSX in parser options. From v8.21.0, eslint announced a new config system. In the new system, .eslintrc* is no longer used. eslint.config.js would be the default config file name. In eslint v8, the legacy system (.eslintrc*) would still be supported, while in eslint v9, only the new system would be supported. And from v8.23.0, eslint CLI starts to look up eslint.config.js. So, if your eslint is >=8.23.0, you're 100% ready to use the new config system.
      » npm install eslint-plugin-react
    
Published   Apr 03, 2025
Version   7.37.5
Author   Yannick Croissant
🌐
Next.js
nextjs.org › docs › app › api-reference › config › eslint
Configuration: ESLint | Next.js
3 days ago - Next.js provides an ESLint configuration package, eslint-config-next, that makes it easy to catch common issues in your application. It includes the @next/eslint-plugin-next plugin along with recommended rule-sets from eslint-plugin-react and eslint-plugin-react-hooks.
🌐
GitHub
github.com › jsx-eslint › eslint-plugin-react
GitHub - jsx-eslint/eslint-plugin-react: React-specific linting rules for ESLint · GitHub
Note: These configurations will import eslint-plugin-react and enable JSX in parser options. From v8.21.0, eslint announced a new config system. In the new system, .eslintrc* is no longer used. eslint.config.js would be the default config file name. In eslint v8, the legacy system (.eslintrc*) would still be supported, while in eslint v9, only the new system would be supported. And from v8.23.0, eslint CLI starts to look up eslint.config.js. So, if your eslint is >=8.23.0, you're 100% ready to use the new config system.
Starred by 9.3K users
Forked by 2.7K users
Languages   JavaScript
Find elsewhere
🌐
DeepWiki
deepwiki.com › facebook › react › 8.3-eslint-plugin-for-react-hooks
ESLint Plugin for React Hooks | facebook/react | DeepWiki
1 month ago - The ESLint plugin for React Hooks (eslint-plugin-react-hooks) is a static analysis tool that enforces the Rules of Hooks—the constraints that govern how React Hooks must be called to ensure correct behavior.
🌐
React
legacy.reactjs.org › docs › hooks-rules.html
Rules of Hooks – React
That’s what allows React to correctly preserve the state of Hooks between multiple useState and useEffect calls. (If you’re curious, we’ll explain this in depth below.) Don’t call Hooks from regular JavaScript functions. Instead, you can: ... By following this rule, you ensure that all stateful logic in a component is clearly visible from its source code. We released an ESLint plugin called eslint-plugin-react-hooks that enforces these two rules.
🌐
npm
npmjs.com › package › eslint-plugin-react-hooks-extra
eslint-plugin-react-hooks-extra - npm
February 14, 2026 - ESLint React's ESLint plugin for React Hooks related rules.. Latest version: 2.13.0, last published: 23 days ago. Start using eslint-plugin-react-hooks-extra in your project by running `npm i eslint-plugin-react-hooks-extra`. There are 17 other projects in the npm registry using eslint-plu...
      » npm install eslint-plugin-react-hooks-extra
    
Published   Feb 14, 2026
Version   2.13.0
Author   Rel1cx
🌐
Reddit
reddit.com › r/reactjs › how to use eslint-plugin-react and eslint-plugin-react-hooks, just for myself?
r/reactjs on Reddit: How to use eslint-plugin-react and eslint-plugin-react-hooks, just for myself?
January 10, 2025 -

Forgive me if this question is poorly worded or misinformed; I'm new to using NPM.

My team has eslint installed as a dev dependency in our project to ensure high code quality. However, we don't use the eslint-plugin-react or eslint-plugin-react-hooks packages. I'd like to install them so that I can follow the best React practices when coding, without actually making changes to the official dependencies used by all developers. Is there a way to go about this (eg, modify a personal "packages.json" that is separate from the project's but will still lint my company's project)?

🌐
GitHub
github.com › reactwg › react-compiler › discussions › 18
Using `eslint-plugin-react-hooks` together with `eslint-plugin-react-compiler` · reactwg/react-compiler · Discussion #18
Compilation failed: useCustomHook.tsx React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior. Found suppression `eslint-disable-next-line react-hooks/exhaustive-deps` Suggestions: 'Remove the ESLint suppression and address the React error'
Author   reactwg
🌐
GitHub
github.com › szhsin › eslint-plugin-react-hooks-addons
GitHub - szhsin/eslint-plugin-react-hooks-addons: ESLint rule to check potentially unintended dependencies in the useEffect hook. · GitHub
ESLint rule to check unused and potentially unnecessary dependencies in React Hooks. eslint-plugin-react-hooks is awesome for linting the dependency array of React Hooks. But it doesn't do one thing: unused dependencies in the useEffect or ...
Starred by 19 users
Forked by 2 users
Languages   JavaScript 50.8% | TypeScript 49.2%
🌐
npm
npmjs.com › search
eslint-plugin-react-hooks - npm search
ESLint React's ESLint plugin for React Hooks related rules.
🌐
npm
npmjs.com › package › @eslint-react › eslint-plugin
@eslint-react/eslint-plugin - npm
2 weeks ago - disable-conflict-eslint-plugin-react-hooks Disable rules in eslint-plugin-react-hooks that conflict with rules in our plugins.
      » npm install @eslint-react/eslint-plugin
    
Published   Mar 15, 2026
Version   3.0.0
Author   Rel1cx
🌐
CodeSandbox
codesandbox.io › examples › package › eslint-plugin-react-hooks
eslint-plugin-react-hooks examples - CodeSandbox
Use this online eslint-plugin-react-hooks playground to view and fork eslint-plugin-react-hooks example apps and templates on CodeSandbox.