Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: exhaustive-deps not working with eslint 9.12.0 #31162

Closed
isneace opened this issue Oct 9, 2024 · 1 comment
Closed

Bug: exhaustive-deps not working with eslint 9.12.0 #31162

isneace opened this issue Oct 9, 2024 · 1 comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@isneace
Copy link

isneace commented Oct 9, 2024

Here is a simplified version of my eslint.config.mjs:
(There are a lot more rules, custom plugins, ignores, files specifications, etc. but for the sake of this bug, I think this will do)

import tseslint from 'typescript-eslint';
import reactHooks from 'eslint-plugin-react-hooks';
import { fixupPluginRules } from '@eslint/compat';

export default tseslint.config({
  plugins: {
    'react-hooks': fixupPluginRules(reactHooks),
  },
  rules: {
    'react-hooks/rules-of-hooks': 'error',
    'react-hooks/exhaustive-deps': 'error',
});

Here are the versions that I am running:

yarn list eslint eslint-plugin-react-hooks typescript-eslint

yarn list v1.22.19
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ eslint-plugin-react-hooks@4.6.2
├─ eslint@9.12.0
└─ typescript-eslint@8.8.1
Done in 0.42s.

If I attempt to run yarn eslint without fixupPluginRules I get the following error:

Oops! Something went wrong! :(

ESLint: 9.12.0

TypeError: context.getSource is not a function
Occurred while linting FILE (this is a placeholder)
Rule: "react-hooks/exhaustive-deps"

When I run yarn lint with fixupPluginRules it works fine.

If found the solution to this here: https://eslint.org/docs/latest/use/troubleshooting/v9-rule-api-changes
That eslint documentation explicitly states that if fixupPluginRules is required, I should open an issue on the plugin
image

@isneace isneace added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Oct 9, 2024
@eps1lon
Copy link
Collaborator

eps1lon commented Oct 11, 2024

Fixed in #28773

@eps1lon eps1lon closed this as completed Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

2 participants