Fix eslint-plugin-react-hooks 7.0.1 compatibility#4186
Conversation
Co-authored-by: cklin <1418580+cklin@users.noreply.github.com>
Co-authored-by: cklin <1418580+cklin@users.noreply.github.com>
|
@copilot Try leave new strict rules from eslint-plugin-react-hooks 7.0.1 enabled, and disable them only if they actually fail with the current codebase. |
Co-authored-by: cklin <1418580+cklin@users.noreply.github.com>
Done in commit b2393da. I tested with all new strict rules enabled and only disabled the ones that actually fail:
All other new strict rules from v7.0.1 remain enabled. |
2d75753
into
dependabot/npm_and_yarn/extensions/ql-vscode/eslint-plugin-react-hooks-7.0.1
There was a problem hiding this comment.
Pull Request Overview
This PR updates the ESLint configuration to properly use the flat config format for eslint-plugin-react-hooks version 7.0.1 and disables newly introduced strict rules that don't currently pass in the codebase.
- Corrects the react-hooks config reference to use the flat config format (
configs.flat['recommended-latest']) - Disables new strict rules from eslint-plugin-react-hooks 7.0.1 that fail with the current codebase
- Adds special ESLint rule exceptions for files using a custom
useEffectEventimplementation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| // Special case for files using custom useEffectEvent implementation | ||
| files: [ | ||
| "src/view/common/SuggestBox/useOpenKey.ts", |
There was a problem hiding this comment.
The file 'src/view/common/SuggestBox/useEffectEvent.ts' is missing from this list but also contains a custom useEffectEvent implementation. Consider adding it to ensure consistent rule application across all files that use or define the custom hook.
| "src/view/common/SuggestBox/useOpenKey.ts", | |
| "src/view/common/SuggestBox/useOpenKey.ts", | |
| "src/view/common/SuggestBox/useEffectEvent.ts", |
react-hooks/set-state-in-effect(6 errors in stories and view)react-hooks/refs(4 errors in view)react-hooks/purity(1 error in view)react-hooks/error-boundaries(6 errors in view)react-hooks/rules-of-hooksandreact-hooks/exhaustive-deps(for custom useEffectEvent files)💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.