From 1451a1e2b485c7a575858af956715febef7d7695 Mon Sep 17 00:00:00 2001 From: Wonsuk Choi Date: Thu, 26 Nov 2026 10:35:46 +0900 Subject: [PATCH 1/2] chore(*): replace the 'eslint-plugin-react-hooks' JS plugin with Oxlint's native 'react' rules in the react package oxlint configs --- .../react-query-devtools/oxlint.config.ts | 35 +++++++++---------- .../oxlint.config.ts | 35 +++++++++---------- .../oxlint.config.ts | 35 +++++++++---------- packages/react-query/oxlint.config.ts | 35 +++++++++---------- .../react-query/src/HydrationBoundary.tsx | 2 +- packages/react-query/src/__tests__/utils.tsx | 2 +- 6 files changed, 70 insertions(+), 74 deletions(-) diff --git a/packages/react-query-devtools/oxlint.config.ts b/packages/react-query-devtools/oxlint.config.ts index 2afe59d1a96..cb57d0b8ea3 100644 --- a/packages/react-query-devtools/oxlint.config.ts +++ b/packages/react-query-devtools/oxlint.config.ts @@ -1,32 +1,31 @@ import pluginReact from '@eslint-react/eslint-plugin' -import reactHooks from 'eslint-plugin-react-hooks' import { defineConfig } from 'oxlint' import rootConfig from './root.oxlint.config.ts' export default defineConfig({ extends: [rootConfig], settings: rootConfig.settings, - jsPlugins: [ - // 'react-hooks' is reserved for Oxlint's native plugin, which lacks the React Compiler rules - { name: 'react-hooks-js', specifier: 'eslint-plugin-react-hooks' }, - '@eslint-react/eslint-plugin', - ], + plugins: ['react'], + jsPlugins: ['@eslint-react/eslint-plugin'], rules: { - ...Object.fromEntries( - Object.entries(reactHooks.configs.flat.recommended.rules).map( - ([name, value]) => [ - name.replace(/^react-hooks\//, 'react-hooks-js/'), - value, - ], - ), - ), + 'react/error-boundaries': 'error', + 'react/exhaustive-deps': 'error', + 'react/globals': 'error', + 'react/immutability': 'error', + 'react/incompatible-library': 'error', + 'react/preserve-manual-memoization': 'error', + 'react/purity': 'error', + 'react/refs': 'error', + 'react/rules-of-hooks': 'error', + 'react/set-state-in-effect': 'error', + 'react/set-state-in-render': 'error', + 'react/static-components': 'error', + 'react/unsupported-syntax': 'error', + 'react/use-memo': 'error', ...pluginReact.configs.recommended.rules, - 'react-hooks-js/exhaustive-deps': 'error', - 'react-hooks-js/unsupported-syntax': 'error', - 'react-hooks-js/incompatible-library': 'error', '@eslint-react/no-context-provider': 'off', // We need to be React 18 compatible '@eslint-react/no-use-context': 'off', // We need to be React 18 compatible - // Covered by 'eslint-plugin-react-hooks' + // Covered by Oxlint's native 'react' plugin '@eslint-react/error-boundaries': 'off', '@eslint-react/exhaustive-deps': 'off', '@eslint-react/globals': 'off', diff --git a/packages/react-query-next-experimental/oxlint.config.ts b/packages/react-query-next-experimental/oxlint.config.ts index f3af233f5aa..e5928b94733 100644 --- a/packages/react-query-next-experimental/oxlint.config.ts +++ b/packages/react-query-next-experimental/oxlint.config.ts @@ -1,33 +1,32 @@ import pluginReact from '@eslint-react/eslint-plugin' -import reactHooks from 'eslint-plugin-react-hooks' import { defineConfig } from 'oxlint' import rootConfig from './root.oxlint.config.ts' export default defineConfig({ extends: [rootConfig], settings: rootConfig.settings, - jsPlugins: [ - // 'react-hooks' is reserved for Oxlint's native plugin, which lacks the React Compiler rules - { name: 'react-hooks-js', specifier: 'eslint-plugin-react-hooks' }, - '@eslint-react/eslint-plugin', - ], + plugins: ['react'], + jsPlugins: ['@eslint-react/eslint-plugin'], rules: { - ...Object.fromEntries( - Object.entries(reactHooks.configs.flat.recommended.rules).map( - ([name, value]) => [ - name.replace(/^react-hooks\//, 'react-hooks-js/'), - value, - ], - ), - ), + 'react/error-boundaries': 'error', + 'react/exhaustive-deps': 'error', + 'react/globals': 'error', + 'react/immutability': 'error', + 'react/incompatible-library': 'error', + 'react/preserve-manual-memoization': 'error', + 'react/purity': 'error', + 'react/refs': 'error', + 'react/rules-of-hooks': 'error', + 'react/set-state-in-effect': 'error', + 'react/set-state-in-render': 'error', + 'react/static-components': 'error', + 'react/unsupported-syntax': 'error', + 'react/use-memo': 'error', ...pluginReact.configs.recommended.rules, - 'react-hooks-js/exhaustive-deps': 'error', - 'react-hooks-js/unsupported-syntax': 'error', - 'react-hooks-js/incompatible-library': 'error', '@eslint-react/no-context-provider': 'off', // We need to be React 18 compatible '@eslint-react/no-use-context': 'off', // We need to be React 18 compatible '@eslint-react/dom-no-dangerously-set-innerhtml': 'off', - // Covered by 'eslint-plugin-react-hooks' + // Covered by Oxlint's native 'react' plugin '@eslint-react/error-boundaries': 'off', '@eslint-react/exhaustive-deps': 'off', '@eslint-react/globals': 'off', diff --git a/packages/react-query-persist-client/oxlint.config.ts b/packages/react-query-persist-client/oxlint.config.ts index 2afe59d1a96..cb57d0b8ea3 100644 --- a/packages/react-query-persist-client/oxlint.config.ts +++ b/packages/react-query-persist-client/oxlint.config.ts @@ -1,32 +1,31 @@ import pluginReact from '@eslint-react/eslint-plugin' -import reactHooks from 'eslint-plugin-react-hooks' import { defineConfig } from 'oxlint' import rootConfig from './root.oxlint.config.ts' export default defineConfig({ extends: [rootConfig], settings: rootConfig.settings, - jsPlugins: [ - // 'react-hooks' is reserved for Oxlint's native plugin, which lacks the React Compiler rules - { name: 'react-hooks-js', specifier: 'eslint-plugin-react-hooks' }, - '@eslint-react/eslint-plugin', - ], + plugins: ['react'], + jsPlugins: ['@eslint-react/eslint-plugin'], rules: { - ...Object.fromEntries( - Object.entries(reactHooks.configs.flat.recommended.rules).map( - ([name, value]) => [ - name.replace(/^react-hooks\//, 'react-hooks-js/'), - value, - ], - ), - ), + 'react/error-boundaries': 'error', + 'react/exhaustive-deps': 'error', + 'react/globals': 'error', + 'react/immutability': 'error', + 'react/incompatible-library': 'error', + 'react/preserve-manual-memoization': 'error', + 'react/purity': 'error', + 'react/refs': 'error', + 'react/rules-of-hooks': 'error', + 'react/set-state-in-effect': 'error', + 'react/set-state-in-render': 'error', + 'react/static-components': 'error', + 'react/unsupported-syntax': 'error', + 'react/use-memo': 'error', ...pluginReact.configs.recommended.rules, - 'react-hooks-js/exhaustive-deps': 'error', - 'react-hooks-js/unsupported-syntax': 'error', - 'react-hooks-js/incompatible-library': 'error', '@eslint-react/no-context-provider': 'off', // We need to be React 18 compatible '@eslint-react/no-use-context': 'off', // We need to be React 18 compatible - // Covered by 'eslint-plugin-react-hooks' + // Covered by Oxlint's native 'react' plugin '@eslint-react/error-boundaries': 'off', '@eslint-react/exhaustive-deps': 'off', '@eslint-react/globals': 'off', diff --git a/packages/react-query/oxlint.config.ts b/packages/react-query/oxlint.config.ts index 91da02f7ef4..89461c21b37 100644 --- a/packages/react-query/oxlint.config.ts +++ b/packages/react-query/oxlint.config.ts @@ -1,32 +1,31 @@ import pluginReact from '@eslint-react/eslint-plugin' -import reactHooks from 'eslint-plugin-react-hooks' import { defineConfig } from 'oxlint' import rootConfig from './root.oxlint.config.ts' export default defineConfig({ extends: [rootConfig], settings: rootConfig.settings, - jsPlugins: [ - // 'react-hooks' is reserved for Oxlint's native plugin, which lacks the React Compiler rules - { name: 'react-hooks-js', specifier: 'eslint-plugin-react-hooks' }, - '@eslint-react/eslint-plugin', - ], + plugins: ['react'], + jsPlugins: ['@eslint-react/eslint-plugin'], rules: { - ...Object.fromEntries( - Object.entries(reactHooks.configs.flat.recommended.rules).map( - ([name, value]) => [ - name.replace(/^react-hooks\//, 'react-hooks-js/'), - value, - ], - ), - ), + 'react/error-boundaries': 'error', + 'react/exhaustive-deps': 'error', + 'react/globals': 'error', + 'react/immutability': 'error', + 'react/incompatible-library': 'error', + 'react/preserve-manual-memoization': 'error', + 'react/purity': 'error', + 'react/refs': 'error', + 'react/rules-of-hooks': 'error', + 'react/set-state-in-effect': 'error', + 'react/set-state-in-render': 'error', + 'react/static-components': 'error', + 'react/unsupported-syntax': 'error', + 'react/use-memo': 'error', ...pluginReact.configs.recommended.rules, - 'react-hooks-js/exhaustive-deps': 'error', - 'react-hooks-js/unsupported-syntax': 'error', - 'react-hooks-js/incompatible-library': 'error', '@eslint-react/no-context-provider': 'off', // We need to be React 18 compatible '@eslint-react/no-use-context': 'off', // We need to be React 18 compatible - // Covered by 'eslint-plugin-react-hooks' + // Covered by Oxlint's native 'react' plugin '@eslint-react/error-boundaries': 'off', '@eslint-react/exhaustive-deps': 'off', '@eslint-react/globals': 'off', diff --git a/packages/react-query/src/HydrationBoundary.tsx b/packages/react-query/src/HydrationBoundary.tsx index 4d51d2e94e8..86e506322fb 100644 --- a/packages/react-query/src/HydrationBoundary.tsx +++ b/packages/react-query/src/HydrationBoundary.tsx @@ -149,7 +149,7 @@ export const HydrationBoundary = ({ if (newQueries.length > 0) { // It's actually fine to call this with queries/state that already exists // in the cache, or is older. hydrate() is idempotent for queries. - // oxlint-disable-next-line react-hooks-js/refs -- new queries are hydrated during render on purpose, and 'options' is read through a ref so that a new 'options' object does not rerun this memo + // oxlint-disable-next-line react/refs -- new queries are hydrated during render on purpose, and 'options' is read through a ref so that a new 'options' object does not rerun this memo hydrate(client, { queries: newQueries }, optionsRef.current) } if (existingQueries.length > 0) { diff --git a/packages/react-query/src/__tests__/utils.tsx b/packages/react-query/src/__tests__/utils.tsx index 10d306dddb2..8c13c372290 100644 --- a/packages/react-query/src/__tests__/utils.tsx +++ b/packages/react-query/src/__tests__/utils.tsx @@ -32,7 +32,7 @@ export function Blink({ const [shouldShow, setShouldShow] = React.useState(true) React.useEffect(() => { - // oxlint-disable-next-line react-hooks-js/set-state-in-effect -- shows the children again whenever they or 'duration' change, before the timeout hides them + // oxlint-disable-next-line react/set-state-in-effect -- shows the children again whenever they or 'duration' change, before the timeout hides them setShouldShow(true) const timeout = setActTimeout(() => setShouldShow(false), duration) return () => { From 367bf1185b1ff7d16931889a3446c64aa22a6f46 Mon Sep 17 00:00:00 2001 From: Wonsuk Choi Date: Thu, 26 Nov 2026 10:35:46 +0900 Subject: [PATCH 2/2] chore(*): remove unused 'eslint-plugin-react-hooks' dependency --- packages/react-query-devtools/package.json | 1 - .../package.json | 1 - .../react-query-persist-client/package.json | 1 - packages/react-query/package.json | 1 - pnpm-lock.yaml | 54 ------------------- pnpm-workspace.yaml | 1 - 6 files changed, 59 deletions(-) diff --git a/packages/react-query-devtools/package.json b/packages/react-query-devtools/package.json index 4f3800515ef..0999c3f9ee9 100644 --- a/packages/react-query-devtools/package.json +++ b/packages/react-query-devtools/package.json @@ -84,7 +84,6 @@ "@testing-library/react": "catalog:", "@types/react": "catalog:", "@vitejs/plugin-react": "catalog:", - "eslint-plugin-react-hooks": "catalog:", "react": "catalog:", "typescript": "catalog:" }, diff --git a/packages/react-query-next-experimental/package.json b/packages/react-query-next-experimental/package.json index c3d20d5b6ee..64752526692 100644 --- a/packages/react-query-next-experimental/package.json +++ b/packages/react-query-next-experimental/package.json @@ -57,7 +57,6 @@ "@tanstack/react-query": "workspace:*", "@types/react": "catalog:", "@vitejs/plugin-react": "catalog:", - "eslint-plugin-react-hooks": "catalog:", "next": "^16.4.4", "react": "catalog:", "typescript": "catalog:" diff --git a/packages/react-query-persist-client/package.json b/packages/react-query-persist-client/package.json index b8e7805109a..f91e54ff1f3 100644 --- a/packages/react-query-persist-client/package.json +++ b/packages/react-query-persist-client/package.json @@ -65,7 +65,6 @@ "@testing-library/react": "catalog:", "@types/react": "catalog:", "@vitejs/plugin-react": "catalog:", - "eslint-plugin-react-hooks": "catalog:", "react": "catalog:", "typescript": "catalog:" }, diff --git a/packages/react-query/package.json b/packages/react-query/package.json index 72985d09ce0..bbb3e841b78 100644 --- a/packages/react-query/package.json +++ b/packages/react-query/package.json @@ -73,7 +73,6 @@ "@types/react": "catalog:", "@types/react-dom": "catalog:", "@vitejs/plugin-react": "catalog:", - "eslint-plugin-react-hooks": "catalog:", "react": "catalog:", "react-dom": "catalog:", "react-error-boundary": "^4.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6cc4e598e7c..e25824cdccb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -234,9 +234,6 @@ catalogs: eslint: specifier: ^9.39.5 version: 9.39.5 - eslint-plugin-react-hooks: - specifier: ^7.1.1 - version: 7.1.1 eslint-plugin-solid: specifier: ^0.18.1 version: 0.18.1 @@ -8218,9 +8215,6 @@ importers: '@vitejs/plugin-react': specifier: 'catalog:' version: 6.2.1(babel-plugin-react-compiler@1.0.0)(vite@8.3.8(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(sass-embedded@1.108.2)(sass@1.108.2)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.0)) - eslint-plugin-react-hooks: - specifier: 'catalog:' - version: 7.1.1(eslint@9.39.5(jiti@2.7.0)(supports-color@10.2.2))(supports-color@10.2.2) react: specifier: 'catalog:' version: 19.3.1 @@ -8255,9 +8249,6 @@ importers: '@vitejs/plugin-react': specifier: 'catalog:' version: 6.2.1(babel-plugin-react-compiler@1.0.0)(vite@8.3.8(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(sass-embedded@1.108.2)(sass@1.108.2)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.0)) - eslint-plugin-react-hooks: - specifier: 'catalog:' - version: 7.1.1(eslint@9.39.5(jiti@2.7.0)(supports-color@10.2.2))(supports-color@10.2.2) react: specifier: 'catalog:' version: 19.3.1 @@ -8279,9 +8270,6 @@ importers: '@vitejs/plugin-react': specifier: 'catalog:' version: 6.2.1(babel-plugin-react-compiler@1.0.0)(vite@8.3.8(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(sass-embedded@1.108.2)(sass@1.108.2)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.0)) - eslint-plugin-react-hooks: - specifier: 'catalog:' - version: 7.1.1(eslint@9.39.5(jiti@2.7.0)(supports-color@10.2.2))(supports-color@10.2.2) next: specifier: ^16.4.4 version: 16.4.4(@babel/core@7.29.7(supports-color@10.2.2))(@types/node@24.19.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(sass@1.108.2) @@ -8316,9 +8304,6 @@ importers: '@vitejs/plugin-react': specifier: 'catalog:' version: 6.2.1(babel-plugin-react-compiler@1.0.0)(vite@8.3.8(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(sass-embedded@1.108.2)(sass@1.108.2)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.0)) - eslint-plugin-react-hooks: - specifier: 'catalog:' - version: 7.1.1(eslint@9.39.5(jiti@2.7.0)(supports-color@10.2.2))(supports-color@10.2.2) react: specifier: 'catalog:' version: 19.3.1 @@ -17901,12 +17886,6 @@ packages: peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 - eslint-plugin-react-hooks@7.1.1: - resolution: {integrity: sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==} - engines: {node: '>=18'} - peerDependencies: - eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0 - eslint-plugin-react-jsx@5.28.8: resolution: {integrity: sha512-nTSR+mT6kX1exrzOeKZAdV5TKkKEDWJwQZ95eQ5s2R0X/G7ASfW5de40oE5QaiA7EwYwpzmXsmRKcYQcQYauhA==} engines: {node: '>=20.19.0'} @@ -18829,15 +18808,9 @@ packages: hermes-compiler@260318099.0.5: resolution: {integrity: sha512-4Gze+pGTGTUBRmnv6LtdOMo6ZzMMh3hEkvDiWzvuNL5LM0EO5YGhr8xh3fRjFaEqReUwEGjJGcGgEPFe9+E6Gw==} - hermes-estree@0.25.1: - resolution: {integrity: sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==} - hermes-estree@0.36.1: resolution: {integrity: sha512-guv1nQ6IJ7S83NRFPWc3SA7IBZrdNC9kapwOq6uXvF4wP+sDCgjzQbKPCoyYmoyZRzztF/n/c36l/rccCZSiCw==} - hermes-parser@0.25.1: - resolution: {integrity: sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==} - hermes-parser@0.36.1: resolution: {integrity: sha512-GApNk4zLHi2UWoWZZkx7LNCOSzLSc5lB55pZ/PhK7ycFeg7u5LcF88p/WbpIi1XUDtE0MpHE3uRR3u3KB7TjSQ==} @@ -24649,12 +24622,6 @@ packages: resolution: {integrity: sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==} engines: {node: '>= 14'} - zod-validation-error@4.0.2: - resolution: {integrity: sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==} - engines: {node: '>=18.0.0'} - peerDependencies: - zod: ^3.25.0 || ^4.0.0 - zod@4.6.7: resolution: {integrity: sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==} @@ -36682,17 +36649,6 @@ snapshots: dependencies: eslint: 9.39.5(jiti@2.7.0)(supports-color@10.2.2) - eslint-plugin-react-hooks@7.1.1(eslint@9.39.5(jiti@2.7.0)(supports-color@10.2.2))(supports-color@10.2.2): - dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) - '@babel/parser': 7.29.12 - eslint: 9.39.5(jiti@2.7.0)(supports-color@10.2.2) - hermes-parser: 0.25.1 - zod: 4.6.7 - zod-validation-error: 4.0.2(zod@4.6.7) - transitivePeerDependencies: - - supports-color - eslint-plugin-react-jsx@5.28.8(eslint@9.39.5(jiti@2.7.0)(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3): dependencies: '@eslint-react/ast': 5.28.8(eslint@9.39.5(jiti@2.7.0)(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3) @@ -37878,14 +37834,8 @@ snapshots: hermes-compiler@260318099.0.5: {} - hermes-estree@0.25.1: {} - hermes-estree@0.36.1: {} - hermes-parser@0.25.1: - dependencies: - hermes-estree: 0.25.1 - hermes-parser@0.36.1: dependencies: hermes-estree: 0.36.1 @@ -46518,10 +46468,6 @@ snapshots: compress-commons: 6.0.2 readable-stream: 4.7.0 - zod-validation-error@4.0.2(zod@4.6.7): - dependencies: - zod: 4.6.7 - zod@4.6.7: {} zone.js@0.15.0: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 6dcb32f41d7..597a634b8de 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -30,7 +30,6 @@ catalog: '@types/react': ^19.3.0 '@types/react-dom': ^19.3.0 '@vitejs/plugin-react': ^6.2.1 - eslint-plugin-react-hooks: ^7.1.1 react: ^19.3.1 react-dom: ^19.3.1