Skip to content

Commit f4a0cd5

Browse files
authored
chore: update eslint-plugin-react-hooks (#9737)
* chore: update eslint-plugin-react-hooks * chore: override warning rules to error * chore: config everywhere * chore: lint violations
1 parent 9f82d8e commit f4a0cd5

File tree

19 files changed

+233
-145
lines changed

19 files changed

+233
-145
lines changed
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
import { tanstackConfig } from '@tanstack/config/eslint'
22
import pluginQuery from '@tanstack/eslint-plugin-query'
33
import pluginReact from '@eslint-react/eslint-plugin'
4-
import * as reactHooks from 'eslint-plugin-react-hooks'
54

65
export default [
76
...tanstackConfig,
87
...pluginQuery.configs['flat/recommended'],
98
pluginReact.configs.recommended,
10-
reactHooks.configs.recommended,
11-
{
12-
rules: {
13-
'react-hooks/exhaustive-deps': 'error',
14-
'react-hooks/rules-of-hooks': 'error',
15-
},
16-
},
179
]
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
import { tanstackConfig } from '@tanstack/config/eslint'
22
import pluginQuery from '@tanstack/eslint-plugin-query'
33
import pluginReact from '@eslint-react/eslint-plugin'
4-
import * as reactHooks from 'eslint-plugin-react-hooks'
54

65
export default [
76
...tanstackConfig,
87
...pluginQuery.configs['flat/recommended'],
98
pluginReact.configs.recommended,
10-
reactHooks.configs.recommended,
11-
{
12-
rules: {
13-
'react-hooks/exhaustive-deps': 'error',
14-
'react-hooks/rules-of-hooks': 'error',
15-
},
16-
},
179
]
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
import { tanstackConfig } from '@tanstack/config/eslint'
22
import pluginQuery from '@tanstack/eslint-plugin-query'
33
import pluginReact from '@eslint-react/eslint-plugin'
4-
import * as reactHooks from 'eslint-plugin-react-hooks'
54

65
export default [
76
...tanstackConfig,
87
...pluginQuery.configs['flat/recommended'],
98
pluginReact.configs.recommended,
10-
reactHooks.configs.recommended,
11-
{
12-
rules: {
13-
'react-hooks/exhaustive-deps': 'error',
14-
'react-hooks/rules-of-hooks': 'error',
15-
},
16-
},
179
]
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
import { tanstackConfig } from '@tanstack/config/eslint'
22
import pluginQuery from '@tanstack/eslint-plugin-query'
33
import pluginReact from '@eslint-react/eslint-plugin'
4-
import * as reactHooks from 'eslint-plugin-react-hooks'
54

65
export default [
76
...tanstackConfig,
87
...pluginQuery.configs['flat/recommended'],
98
pluginReact.configs.recommended,
10-
reactHooks.configs.recommended,
11-
{
12-
rules: {
13-
'react-hooks/exhaustive-deps': 'error',
14-
'react-hooks/rules-of-hooks': 'error',
15-
},
16-
},
179
]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"@vitest/eslint-plugin": "^1.1.36",
5555
"esbuild-plugin-file-path-extensions": "^2.1.4",
5656
"eslint": "^9.36.0",
57-
"eslint-plugin-react-hooks": "^6.0.0-rc.2",
57+
"eslint-plugin-react-hooks": "^6.1.1",
5858
"jsdom": "^27.0.0",
5959
"knip": "^5.63.1",
6060
"markdown-link-extractor": "^4.0.2",
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
// @ts-check
22

33
import pluginReact from '@eslint-react/eslint-plugin'
4-
import * as reactHooks from 'eslint-plugin-react-hooks'
4+
import reactHooks from 'eslint-plugin-react-hooks'
55
import rootConfig from './root.eslint.config.js'
66

77
export default [
88
...rootConfig,
9-
reactHooks.configs.recommended,
9+
// @ts-expect-error wtf
10+
...reactHooks.configs['recommended-latest'],
1011
{
1112
files: ['**/*.{ts,tsx}'],
1213
...pluginReact.configs.recommended,
1314
rules: {
1415
'@eslint-react/no-context-provider': 'off', // We need to be React 18 compatible
15-
},
16-
},
17-
{
18-
rules: {
1916
'react-hooks/exhaustive-deps': 'error',
2017
'react-hooks/rules-of-hooks': 'error',
21-
'react-hooks/react-compiler': 'error',
18+
'react-hooks/unsupported-syntax': 'error',
19+
'react-hooks/incompatible-library': 'error',
2220
},
2321
},
2422
]
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
// @ts-check
22

33
import pluginReact from '@eslint-react/eslint-plugin'
4-
import * as reactHooks from 'eslint-plugin-react-hooks'
4+
import reactHooks from 'eslint-plugin-react-hooks'
55
import rootConfig from './root.eslint.config.js'
66

77
export default [
88
...rootConfig,
9-
reactHooks.configs.recommended,
9+
// @ts-expect-error wtf
10+
...reactHooks.configs['recommended-latest'],
1011
{
1112
files: ['**/*.{ts,tsx}'],
1213
...pluginReact.configs.recommended,
1314
rules: {
1415
'@eslint-react/no-context-provider': 'off', // We need to be React 18 compatible
15-
},
16-
},
17-
{
18-
rules: {
19-
'@eslint-react/no-unstable-context-value': 'off',
2016
'react-hooks/exhaustive-deps': 'error',
2117
'react-hooks/rules-of-hooks': 'error',
22-
'react-hooks/react-compiler': 'error',
18+
'react-hooks/unsupported-syntax': 'error',
19+
'react-hooks/incompatible-library': 'error',
2320
},
2421
},
2522
]

packages/react-query-next-experimental/src/HydrationStreamProvider.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export function createHydrationStreamProvider<TShape>() {
130130
.join(',')
131131

132132
// Flush stream
133-
// eslint-disable-next-line react-hooks/react-compiler
133+
// eslint-disable-next-line react-hooks/immutability
134134
stream.length = 0
135135

136136
const html: Array<string> = [
@@ -169,6 +169,7 @@ export function createHydrationStreamProvider<TShape>() {
169169

170170
onEntries(...winStream)
171171

172+
// eslint-disable-next-line react-hooks/immutability
172173
win[id] = {
173174
initialized: true,
174175
push: onEntries,
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
// @ts-check
22

33
import pluginReact from '@eslint-react/eslint-plugin'
4-
import * as reactHooks from 'eslint-plugin-react-hooks'
4+
import reactHooks from 'eslint-plugin-react-hooks'
55
import rootConfig from './root.eslint.config.js'
66

77
export default [
88
...rootConfig,
9-
reactHooks.configs.recommended,
9+
// @ts-expect-error wtf
10+
...reactHooks.configs['recommended-latest'],
1011
{
1112
files: ['**/*.{ts,tsx}'],
1213
...pluginReact.configs.recommended,
1314
rules: {
1415
'@eslint-react/no-context-provider': 'off', // We need to be React 18 compatible
15-
},
16-
},
17-
{
18-
rules: {
1916
'react-hooks/exhaustive-deps': 'error',
2017
'react-hooks/rules-of-hooks': 'error',
21-
'react-hooks/react-compiler': 'error',
18+
'react-hooks/unsupported-syntax': 'error',
19+
'react-hooks/incompatible-library': 'error',
2220
},
2321
},
2422
]

packages/react-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ describe('PersistQueryClientProvider', () => {
371371
const state = useQuery({
372372
queryKey: key,
373373
queryFn: async () => {
374-
// eslint-disable-next-line react-hooks/react-compiler
375374
fetched = true
376375
await sleep(10)
377376
return 'fetched'

0 commit comments

Comments
 (0)