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

eslint-plugin-react-redux is incompatible with eslint v9 #99

Open
stan-stately opened this issue Apr 8, 2024 · 9 comments
Open

eslint-plugin-react-redux is incompatible with eslint v9 #99

stan-stately opened this issue Apr 8, 2024 · 9 comments

Comments

@stan-stately
Copy link

TypeError: Error while loading rule 'react-redux/mapStateToProps-prefer-hoisted': Rule must be an object with a `create` method

They have dropped support for function style rules in v9: https://eslint.org/blog/2023/11/whats-coming-in-eslint-9.0.0/#changes-to-how-you-write-rules

@mike-lock
Copy link

Any indication when (or whether) this issue will get resolved?

@DianaSuvorova
Copy link
Owner

Hello! I have created a branch that supports the v9. #100. Although there is a number of underlying dependencies that do not support v9 yet. We an either force install, to ignore peer deps npm validation (which I think is not a right path forward) or we wait for the rest of the eco system to catch up.

@mike-lock
Copy link

Any updates on this?

@DianaSuvorova
Copy link
Owner

Here is a diff for eslint 9 support #101
Will land this one and do release by end of week.

@mike-lock
Copy link

Would love this release! Hopefully we can upgrade ESLint to the latest version at our company after this :)

@DianaSuvorova
Copy link
Owner

I just published 4.2.0. Let me know if you run into issues

@mike-lock
Copy link

Thanks! I will try it out immediately!

@mike-lock
Copy link

mike-lock commented Oct 4, 2024

Sorry for the late response. There were other plugins that weren't compatible with ESLint v9.
It is working, but not in the recommended way. I now need it like this:

import reactRedux from 'eslint-plugin-react-redux'

export default tsEsLint.config(
{
  plugins: {
    ['react-redux']: reactRedux.configs.recommended.plugins,
  },
  rules: {
    ...reactRedux.rules.recommended,
})

Instead of the recommended way:

import reactRedux from 'eslint-plugin-react-redux'

export default tsEsLint.config(
  reactRedux.configs.recommended, // Or a new variant that manages this for backwards compatibility, like reactRedux.flatconfigs.recommended
)

The new recommended way just inserts all the plugins / rules to the lists. No need for extra lines of configuration.

@ljharb
Copy link
Collaborator

ljharb commented Oct 4, 2024

Better would be to import it from eslint-plugin-react-redux/flat, imo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants