Skip to content

Commit 34eedd6

Browse files
authored
chore: update to eslint-plugin-react-hooks v6 (#9071)
* chore: update to eslint-plugin-react-hooks v6 and remove the separate compiler linter plugin, as those rules are now integrated * chore: disable compiler-linter in tests * chore: bypass lint violations * chore: Disable '@eslint-react/no-context-provider' to be react 18 compatible
1 parent 9e30aaf commit 34eedd6

File tree

16 files changed

+127
-155
lines changed

16 files changed

+127
-155
lines changed

.github/renovate.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"@types/node",
2121
"@types/react",
2222
"@types/react-dom",
23-
"eslint-plugin-react-compiler",
2423
"node",
2524
"react",
2625
"react-dom",

examples/react/algolia/eslint.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
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 pluginReactHooks from 'eslint-plugin-react-hooks'
4+
import * as reactHooks from 'eslint-plugin-react-hooks'
55

66
export default [
77
...tanstackConfig,
88
...pluginQuery.configs['flat/recommended'],
99
pluginReact.configs.recommended,
10+
reactHooks.configs.recommended,
1011
{
11-
plugins: {
12-
'react-hooks': pluginReactHooks,
13-
},
1412
rules: {
1513
'react-hooks/exhaustive-deps': 'error',
1614
'react-hooks/rules-of-hooks': 'error',

examples/react/basic-graphql-request/eslint.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
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 pluginReactHooks from 'eslint-plugin-react-hooks'
4+
import * as reactHooks from 'eslint-plugin-react-hooks'
55

66
export default [
77
...tanstackConfig,
88
...pluginQuery.configs['flat/recommended'],
99
pluginReact.configs.recommended,
10+
reactHooks.configs.recommended,
1011
{
11-
plugins: {
12-
'react-hooks': pluginReactHooks,
13-
},
1412
rules: {
1513
'react-hooks/exhaustive-deps': 'error',
1614
'react-hooks/rules-of-hooks': 'error',

examples/react/basic/eslint.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
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 pluginReactHooks from 'eslint-plugin-react-hooks'
4+
import * as reactHooks from 'eslint-plugin-react-hooks'
55

66
export default [
77
...tanstackConfig,
88
...pluginQuery.configs['flat/recommended'],
99
pluginReact.configs.recommended,
10+
reactHooks.configs.recommended,
1011
{
11-
plugins: {
12-
'react-hooks': pluginReactHooks,
13-
},
1412
rules: {
1513
'react-hooks/exhaustive-deps': 'error',
1614
'react-hooks/rules-of-hooks': 'error',

examples/react/shadow-dom/eslint.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
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 pluginReactHooks from 'eslint-plugin-react-hooks'
4+
import * as reactHooks from 'eslint-plugin-react-hooks'
55

66
export default [
77
...tanstackConfig,
88
...pluginQuery.configs['flat/recommended'],
99
pluginReact.configs.recommended,
10+
reactHooks.configs.recommended,
1011
{
11-
plugins: {
12-
'react-hooks': pluginReactHooks,
13-
},
1412
rules: {
1513
'react-hooks/exhaustive-deps': 'error',
1614
'react-hooks/rules-of-hooks': 'error',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"cpy-cli": "^5.0.0",
5252
"esbuild-plugin-file-path-extensions": "^2.1.4",
5353
"eslint": "^9.15.0",
54-
"eslint-plugin-react-hooks": "^5.2.0",
54+
"eslint-plugin-react-hooks": "^6.0.0-rc.1",
5555
"fast-glob": "^3.3.3",
5656
"jsdom": "^25.0.1",
5757
"knip": "^5.50.2",
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
// @ts-check
22

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

77
export default [
88
...rootConfig,
9+
reactHooks.configs.recommended,
910
{
1011
files: ['**/*.{ts,tsx}'],
1112
...pluginReact.configs.recommended,
13+
rules: {
14+
'@eslint-react/no-context-provider': 'off', // We need to be React 18 compatible
15+
},
1216
},
1317
{
14-
plugins: {
15-
'react-hooks': pluginReactHooks,
16-
},
1718
rules: {
1819
'react-hooks/exhaustive-deps': 'error',
1920
'react-hooks/rules-of-hooks': 'error',
21+
'react-hooks/react-compiler': 'error',
2022
},
2123
},
2224
]
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
// @ts-check
22

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

77
export default [
88
...rootConfig,
9+
reactHooks.configs.recommended,
910
{
1011
files: ['**/*.{ts,tsx}'],
1112
...pluginReact.configs.recommended,
13+
rules: {
14+
'@eslint-react/no-context-provider': 'off', // We need to be React 18 compatible
15+
},
1216
},
1317
{
14-
plugins: {
15-
'react-hooks': pluginReactHooks,
16-
},
1718
rules: {
1819
'@eslint-react/no-unstable-context-value': 'off',
1920
'react-hooks/exhaustive-deps': 'error',
2021
'react-hooks/rules-of-hooks': 'error',
22+
'react-hooks/react-compiler': 'error',
2123
},
2224
},
2325
]

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

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

132132
// Flush stream
133+
// eslint-disable-next-line react-hooks/react-compiler
133134
stream.length = 0
134135

135136
const html: Array<string> = [
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
// @ts-check
22

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

77
export default [
88
...rootConfig,
9+
reactHooks.configs.recommended,
910
{
1011
files: ['**/*.{ts,tsx}'],
1112
...pluginReact.configs.recommended,
13+
rules: {
14+
'@eslint-react/no-context-provider': 'off', // We need to be React 18 compatible
15+
},
1216
},
1317
{
14-
plugins: {
15-
'react-hooks': pluginReactHooks,
16-
},
1718
rules: {
1819
'react-hooks/exhaustive-deps': 'error',
1920
'react-hooks/rules-of-hooks': 'error',
21+
'react-hooks/react-compiler': 'error',
2022
},
2123
},
2224
]

0 commit comments

Comments
 (0)