Skip to content

Commit 0106829

Browse files
authored
build(client): upgrade react eslint plugins (#26007)
Updates the ESLint React and React Hooks plugin dependencies to their latest versions and enables several new React Hooks linting rules that are available in these newer versions. **ESLint plugin upgrades:** - Upgraded `eslint-plugin-react` from `~7.33.2` to `~7.35.0` and `eslint-plugin-react-hooks` from `~5.2.0` to `~7.0.1` in both `package.json` and `pnpm-lock.yaml`. This enables compatibility with ESLint 9 and unlocks new linting rules. Several of the rules were downgraded to warning while we get through the eslint 9 upgrade. They can be revisited once the upgrade is done.
1 parent 264b981 commit 0106829

File tree

14 files changed

+499
-89
lines changed

14 files changed

+499
-89
lines changed

common/build/eslint-config-fluid/CHANGELOG.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,30 @@ Packages can now use `eslint.config.mjs` instead of `.eslintrc.cjs`, but the leg
1717

1818
### ESLint Rule Changes
1919

20-
**react-hooks/rules-of-hooks**: Temporarily downgraded from `"error"` to `"warn"` until ESLint 9 migration completes and React plugins are upgraded to more recent versions.
20+
**React Hooks plugin upgraded**: Upgraded from `~5.2.0` to `~7.0.1`, enabling several new React Hooks linting rules.
21+
22+
**New react-hooks rules enabled as `"error"`**:
23+
24+
- `react-hooks/component-hook-factories`
25+
- `react-hooks/config`
26+
- `react-hooks/error-boundaries`
27+
- `react-hooks/gating`
28+
- `react-hooks/globals`
29+
- `react-hooks/preserve-manual-memoization`
30+
- `react-hooks/purity`
31+
- `react-hooks/set-state-in-render`
32+
- `react-hooks/use-memo`
33+
34+
**React-hooks rules temporarily downgraded to `"warn"`** (until ESLint 9 migration completes):
35+
36+
- `react-hooks/rules-of-hooks`: Changed from `"error"` to `"warn"`
37+
- `react-hooks/exhaustive-deps`: Changed from `"error"` to `"warn"`
38+
- `react-hooks/immutability`: New rule set to `"warn"`
39+
- `react-hooks/incompatible-library`: New rule set to `"warn"`
40+
- `react-hooks/refs`: New rule set to `"warn"`
41+
- `react-hooks/set-state-in-effect`: New rule set to `"warn"`
42+
- `react-hooks/static-components`: New rule set to `"warn"`
43+
- `react-hooks/unsupported-syntax`: New rule set to `"warn"`
2144

2245
**New unicorn rules** (enabled as `"error"` by default):
2346

common/build/eslint-config-fluid/minimal-deprecated.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,13 @@ module.exports = {
422422
],
423423
extends: ["plugin:react/recommended", "plugin:react-hooks/recommended"],
424424
rules: {
425-
// TODO: This should be re-enabled once we are on eslint 9
425+
// TODO: These rules should be re-enabled once we are on eslint 9
426426
// and the react plugins are upgraded to more recent versions
427+
"react-hooks/immutability": "warn",
428+
"react-hooks/refs": "warn",
427429
"react-hooks/rules-of-hooks": "warn",
430+
"react-hooks/set-state-in-effect": "warn",
431+
"react-hooks/static-components": "warn",
428432
},
429433
settings: {
430434
react: {

common/build/eslint-config-fluid/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"eslint-plugin-import-x": "~4.16.1",
3939
"eslint-plugin-jsdoc": "~61.4.1",
4040
"eslint-plugin-promise": "~7.2.1",
41-
"eslint-plugin-react": "~7.33.2",
42-
"eslint-plugin-react-hooks": "~5.2.0",
41+
"eslint-plugin-react": "~7.35.0",
42+
"eslint-plugin-react-hooks": "~7.0.1",
4343
"eslint-plugin-tsdoc": "~0.5.0",
4444
"eslint-plugin-unicorn": "~54.0.0",
4545
"eslint-plugin-unused-imports": "~4.3.0"

0 commit comments

Comments
 (0)