eslint-plugin-react-redux
eslint-plugin-react-redux copied to clipboard
eslint-plugin-react-redux is incompatible with eslint v9
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
Any indication when (or whether) this issue will get resolved?
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.
Any updates on this?
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.
Would love this release! Hopefully we can upgrade ESLint to the latest version at our company after this :)
I just published 4.2.0. Let me know if you run into issues
Thanks! I will try it out immediately!
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.
Better would be to import it from eslint-plugin-react-redux/flat, imo.