eslint-plugin-react-redux icon indicating copy to clipboard operation
eslint-plugin-react-redux copied to clipboard

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

Open stan-stately opened this issue 1 year ago • 9 comments

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

stan-stately avatar Apr 08 '24 00:04 stan-stately

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

mike-lock avatar Apr 24 '24 14:04 mike-lock

Hello! I have created a branch that supports the v9. https://github.com/DianaSuvorova/eslint-plugin-react-redux/pull/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.

DianaSuvorova avatar Apr 28 '24 20:04 DianaSuvorova

Any updates on this?

mike-lock avatar Aug 15 '24 12:08 mike-lock

Here is a diff for eslint 9 support https://github.com/DianaSuvorova/eslint-plugin-react-redux/pull/101 Will land this one and do release by end of week.

DianaSuvorova avatar Aug 20 '24 18:08 DianaSuvorova

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

mike-lock avatar Aug 26 '24 07:08 mike-lock

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

DianaSuvorova avatar Aug 31 '24 03:08 DianaSuvorova

Thanks! I will try it out immediately!

mike-lock avatar Sep 02 '24 07:09 mike-lock

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.

mike-lock avatar Oct 04 '24 07:10 mike-lock

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

ljharb avatar Oct 04 '24 08:10 ljharb