Skip to content

Commit 2d75753

Browse files
Copilotcklin
andauthored
Fix eslint-plugin-react-hooks 7.0.1 compatibility (#4186)
* Initial plan * Update eslint-plugin-react-hooks configuration for flat config format Co-authored-by: cklin <1418580+cklin@users.noreply.github.com> * Fix eslint-plugin-react-hooks 7.0.1 linting issues Co-authored-by: cklin <1418580+cklin@users.noreply.github.com> * Only disable strict rules that actually fail with current codebase Co-authored-by: cklin <1418580+cklin@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cklin <1418580+cklin@users.noreply.github.com>
1 parent 6c81a71 commit 2d75753

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

extensions/ql-vscode/eslint.config.mjs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export default tseslint.config(
113113
extends: [
114114
react.configs.flat.recommended,
115115
react.configs.flat['jsx-runtime'],
116-
reactHooks.configs['recommended-latest'],
116+
reactHooks.configs.flat['recommended-latest'],
117117
storybook.configs['flat/recommended'],
118118
github.getFlatConfigs().react,
119119
],
@@ -122,6 +122,10 @@ export default tseslint.config(
122122
version: "detect",
123123
},
124124
},
125+
rules: {
126+
// Disable new strict rules from eslint-plugin-react-hooks 7.0.1 that fail with current codebase
127+
"react-hooks/set-state-in-effect": "off",
128+
},
125129
},
126130
{
127131
files: ["src/view/**/*"],
@@ -133,14 +137,32 @@ export default tseslint.config(
133137
extends: [
134138
react.configs.flat.recommended,
135139
react.configs.flat['jsx-runtime'],
136-
reactHooks.configs['recommended-latest'],
140+
reactHooks.configs.flat['recommended-latest'],
137141
github.getFlatConfigs().react,
138142
],
139143
settings: {
140144
react: {
141145
version: "detect",
142146
},
143147
},
148+
rules: {
149+
// Disable new strict rules from eslint-plugin-react-hooks 7.0.1 that fail with current codebase
150+
"react-hooks/set-state-in-effect": "off",
151+
"react-hooks/refs": "off",
152+
"react-hooks/purity": "off",
153+
"react-hooks/error-boundaries": "off",
154+
},
155+
},
156+
{
157+
// Special case for files using custom useEffectEvent implementation
158+
files: [
159+
"src/view/common/SuggestBox/useOpenKey.ts",
160+
"src/view/common/SuggestBox/__tests__/useEffectEvent.test.ts",
161+
],
162+
rules: {
163+
"react-hooks/rules-of-hooks": "off",
164+
"react-hooks/exhaustive-deps": "off",
165+
},
144166
},
145167
{
146168
files: ["test/vscode-tests/**/*"],

0 commit comments

Comments
 (0)