-
Notifications
You must be signed in to change notification settings - Fork 49k
Description
👋 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 documented support yet. But, based on searching around (e.g. vercel/next.js#49337), ESLint v9 is basically supported if you wire it up manually in your config:
// 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,
},
];
Most community plugins provide a more convenient wrapper. For example, eslint-plugin-jsdoc
provides a jsdoc.configs['flat/recommended']
object:
// eslint.config.js
import jsdoc from 'eslint-plugin-jsdoc';
export default [
jsdoc.configs['flat/recommended'],
];
Would the React team be open to a PR adding in a preset object like that? And either way, updating the docs on https://www.npmjs.com/package/eslint-plugin-react-hooks?
Note: this was also filed as reactjs/react.dev#6430.
I'm posting this issue here as a reference & cross-linking it to the table in eslint/eslint#18093. If there's anything technical blocking the extension from working with flat configs, please let us know - we'd be happy to try to help! 💜
Additional resources:
- Configuration Migration Guide
- (edit) Plugin Migration Guide
- Blog posts on the new config system: Part 1: Background, Part 2: Introduction to flat config
(sorry for not using the issue templates - I wasn't sure whether this would count as a bug)