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
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

🌐
npm
npmjs.com › package › eslint-plugin-react-hooks
eslint-plugin-react-hooks - npm
// eslint.config.js import reactHooks from 'eslint-plugin-react-hooks'; import { defineConfig } from 'eslint/config'; export default defineConfig([ reactHooks.configs.flat['recommended-latest'], ]); If you are still using ESLint below 9.0.0, the recommended preset can also be used to enable all recommended rules.
      » npm install eslint-plugin-react-hooks
    
Published   Oct 24, 2025
Version   7.0.1
Homepage   https://react.dev/
Discussions

eslint-plugin-react-hooks & "Flat Config" (ESLint 9)
👋 Coming over from eslint/eslint#18093: ESLint is migrating to a new "flat config" format that will be the default in ESLint v9. It doesn't look like eslint-plugin-react-hooks has doc... More on github.com
🌐 github.com
108
February 13, 2024
cannot upgrade `eslint` to v9 due to `eslint-plugin-react-hooks` peer dependancies
eslint-plugin-react-hooks does not currently support the latest version on eslint, eslint@9.10.0 React version: 18.3.1 Steps To Reproduce create a new react application install eslint @ 8.56.0 inst... More on github.com
🌐 github.com
8
August 10, 2024
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
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
🌐
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 ...
🌐
GitHub
github.com › facebook › react › issues › 28313
eslint-plugin-react-hooks & "Flat Config" (ESLint 9) · Issue #28313 · facebook/react
February 13, 2024 - // eslint.config.js import eslint from "@eslint/js"; import hooksPlugin from "eslint-plugin-react-hooks"; export default [ eslint.configs.recommended, { plugins: { "react-hooks": hooksPlugin, }, rules: hooksPlugin.configs.recommended.rules, }, ];
Author   JoshuaKGoldberg
🌐
GitHub
github.com › facebook › react › tree › main › packages › eslint-plugin-react-hooks
react/packages/eslint-plugin-react-hooks at main · facebook/react
// eslint.config.js import reactHooks from 'eslint-plugin-react-hooks'; import { defineConfig } from 'eslint/config'; export default defineConfig([ reactHooks.configs.flat['recommended-latest'], ]); If you are still using ESLint below 9.0.0, the recommended preset can also be used to enable all recommended rules.
Author   facebook
🌐
GitHub
github.com › facebook › react › issues › 30932
cannot upgrade `eslint` to v9 due to `eslint-plugin-react-hooks` peer dependancies · Issue #30932 · facebook/react
August 10, 2024 - eslint-plugin-react-hooks does not currently support the latest version on eslint, eslint@9.10.0 React version: 18.3.1 Steps To Reproduce create a new react application install eslint @ 8.56.0 install eslint-plugin-react-hooks @ 4.6.2 tr...
Author   DeadEnglish
🌐
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)?

Find elsewhere
🌐
GitHub
github.com › jsx-eslint › eslint-plugin-react
GitHub - jsx-eslint/eslint-plugin-react: React-specific linting rules for ESLint · GitHub
This plugin exports a recommended configuration that enforces React good practices. To enable this configuration use the extends property in your .eslintrc config file:
Starred by 9.3K users
Forked by 2.7K users
Languages   JavaScript
🌐
Next.js
nextjs.org › docs › app › api-reference › config › eslint
Configuration: ESLint | Next.js
November 10, 2025 - 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.
🌐
Sitecore
doc.sitecore.com › sai › en › developers › content-sdk › update-eslint-to-version-9.html
Update ESLint to version 9 | Sitecore Documentation
import { defineConfig } from 'eslint/config'; import js from '@eslint/js'; import pluginNext from '@next/eslint-plugin-next'; import tsParser from '@typescript-eslint/parser'; import tsPlugin from '@typescript-eslint/eslint-plugin'; import importPlugin from 'eslint-plugin-import'; import reactHooks from 'eslint-plugin-react-hooks'; import globals from 'globals'; export default defineConfig([ { plugins: { '@next/next': pluginNext, '@typescript-eslint': tsPlugin, import: importPlugin, 'react-hooks': reactHooks, }, }, { files: ['**/*.{js,jsx,ts,tsx}'], languageOptions: { parser: tsParser, parserO
🌐
GitHub
github.com › facebook › react › blob › main › packages › eslint-plugin-react-hooks › README.md
react/packages/eslint-plugin-react-hooks/README.md at main · facebook/react
November 16, 2025 - // eslint.config.js import reactHooks from 'eslint-plugin-react-hooks'; import { defineConfig } from 'eslint/config'; export default defineConfig([ reactHooks.configs.flat['recommended-latest'], ]); If you are still using ESLint below 9.0.0, the recommended preset can also be used to enable all recommended rules.
Author   facebook
🌐
DEV Community
dev.to › ajmal_hasan › eslint-prettier-setup-for-latest-react-native-with-typescript-17do
React Native ESLint 9 Setup: Complete Guide with VSCode Integration, Husky Pre-commit Hooks, Prettier, and CI/CD - DEV Community
November 9, 2025 - # 1. Install everything yarn add --dev eslint @eslint/js globals typescript-eslint eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-native prettier eslint-config-prettier husky lint-staged @types/node # 2. Initialize husky yarn prepare # 3. Setup pre-commit hooks npx husky add .husky/pre-commit "npx lint-staged" npx husky add .husky/pre-push "yarn lint:check" # 4.
🌐
Reddit
reddit.com › r/reactjs › can eslint "react-hooks/exhaustive-deps" safely be ignored with rtk dispatch?
r/reactjs on Reddit: Can ESLint "react-hooks/exhaustive-deps" safely be ignored with RTK dispatch?
June 1, 2024 -

When I want a useEffect to run on component mount, I pass an empty array as the dependency list. As far as I know, this is the canonical way to achieve this behaviour in functional React, but ESLint doesn't like it in a lot of cases, e.g.:

const dispatch = useAppDispatch();

useEffect(() => {
  // some logic
  dispatch(something());
}, []);

Will generate an ESLint react-hooks/exhaustive-deps warning because of dispatch, which I'll have to suppress. Anytime I need to suppress a warning I try to use it as a cue to rework how I'm approaching a problem, but I don't really see an alternative approach here without seriously overcomplicating things.

Are there any potentially disastrous consequences to doing this that I'm overlooking?

🌐
Reddit
reddit.com › r/learnjavascript › has anyone switched to eslint 9 configuration files?
r/learnjavascript on Reddit: Has anyone switched to ESLint 9 Configuration files?
June 7, 2024 -

I have some projects with Eslint 8 and setup with its `.eslintrc.json` configuration files.

With ESLint 9, configuration files are switched to flat configuration

https://eslint.org/docs/latest/use/configure/configuration-files

Even if you switch to flat configuration, it still needs to be enabled in VSCode as experimental setting

"eslint.experimental.useFlatConfig": true

My projects are working OK with old Eslint 8 support. I want to ask should I switch to Eslint 9 and flat configuration? Especially that experimental setting makes me wonder is this new configuration system is reliable enough at its current state?

🌐
Stack Overflow
stackoverflow.com › questions › tagged › eslint-plugin-react-hooks
Newest 'eslint-plugin-react-hooks' Questions - Stack Overflow
I can turn that rule of for entire array: useEffect(() => { if (id) { stableCallback(id); dynamicCallback(id); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [... ... I am trying to setup eslint that can provide me errors and warning in expo react native project. I added these rules but it seems like they are not working. This is how my .eslintrc.js looks like ... ... When using the package: https://www.npmjs.com/package/eslint-plugin-react-hooks Is it supposed to add visual yellow underline warnings on react component while using vscode?
🌐
Reddit
reddit.com › r/reactjs › upgrading eslint to v9: what to do with eslint-config-react-app?
r/reactjs on Reddit: Upgrading eslint to v9: What to do with eslint-config-react-app?
January 3, 2025 -

Hi all!

I am currently trying to upgrade eslint to v9 in some projects and am running into a few issues here and there.
I think the biggest issue is that CRA is dropped (we already migrated to Vite) and eslint-config-react-app is no longer maintained, which we have been using since a few years now. I have been trying to re-implement it locally in a project, but that's a really tedious act, e.g. validating which rules are not needed.

Did anyone run into this issue as well? What did you do?
And generally: What does your eslint v9 config look like?

PS: Please don't recommend Biome, Oxlint or other tools as a replacement. I am aware of these and they look really promising, but they do not meet our requirements (yet!) :)

🌐
GitHub
github.com › reactjs › react.dev › issues › 6430
How to configure `eslint-plugin-react-hooks` in `eslint.config.js` · Issue #6430 · reactjs/react.dev
September 27, 2023 - Fork 7.9k · Star 11.7k · New ... actions · Starting with the next version 9, ESLint will deprecate the current eslintrc format and will default use the new flat config format (eslint.config.js)....
Author   rakleed