You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/reference/eslint-plugin-react-hooks/index.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
---
2
2
title: eslint-plugin-react-hooks
3
+
version: rc
3
4
---
4
5
5
6
<Intro>
@@ -8,6 +9,14 @@ title: eslint-plugin-react-hooks
8
9
9
10
</Intro>
10
11
12
+
<RC>
13
+
14
+
These docs include rules available in the RC version of `eslint-plugin-react-hooks`.
15
+
16
+
You can try them by upgrading the lint plugin [to the most recent RC version](/learn/react-compiler/installation#eslint-integration).
17
+
18
+
</RC>
19
+
11
20
This plugin helps you catch violations of React's rules at build time, ensuring your components and hooks follow React's rules for correctness and performance. The lints cover both fundamental React patterns (exhaustive-deps and rules-of-hooks) and issues flagged by React Compiler. React Compiler diagnostics are automatically surfaced by this ESLint plugin, and can be used even if your app hasn't adopted the compiler yet.
12
21
13
22
<Note>
@@ -18,18 +27,23 @@ What this means for linting, is that you don’t need to fix all violations imme
18
27
19
28
## Available Lints {/*available-lints*/}
20
29
21
-
*[`component-hook-factories`](/reference/eslint-plugin-react-hooks/lints/component-hook-factories) - Validates against higher order functions defining nested components or hooks
30
+
These rules are available in the stable version of `eslint-plugin-react-hooks`:
31
+
32
+
*[`exhaustive-deps`](/reference/eslint-plugin-react-hooks/lints/exhaustive-deps) - Validates that dependency arrays for React hooks contain all necessary dependencies
33
+
*[`rules-of-hooks`](/reference/eslint-plugin-react-hooks/lints/rules-of-hooks) - Validates that components and hooks follow the Rules of Hooks
34
+
35
+
These rules are available in the RC version of `eslint-plugin-react-hooks`:
36
+
37
+
*[`component-hook-factories`](/reference/eslint-plugin-react-hooks/lints/component-hook-factories) - Validates higher order functions defining nested components or hooks
22
38
*[`config`](/reference/eslint-plugin-react-hooks/lints/config) - Validates the compiler configuration options
23
39
*[`error-boundaries`](/reference/eslint-plugin-react-hooks/lints/error-boundaries) - Validates usage of Error Boundaries instead of try/catch for child errors
24
-
*[`exhaustive-deps`](/reference/eslint-plugin-react-hooks/lints/exhaustive-deps) - Validates that dependency arrays for React hooks contain all necessary dependencies
25
40
*[`gating`](/reference/eslint-plugin-react-hooks/lints/gating) - Validates configuration of gating mode
26
41
*[`globals`](/reference/eslint-plugin-react-hooks/lints/globals) - Validates against assignment/mutation of globals during render
27
42
*[`immutability`](/reference/eslint-plugin-react-hooks/lints/immutability) - Validates against mutating props, state, and other immutable values
28
43
*[`incompatible-library`](/reference/eslint-plugin-react-hooks/lints/incompatible-library) - Validates against usage of libraries which are incompatible with memoization
29
44
*[`preserve-manual-memoization`](/reference/eslint-plugin-react-hooks/lints/preserve-manual-memoization) - Validates that existing manual memoization is preserved by the compiler
30
45
*[`purity`](/reference/eslint-plugin-react-hooks/lints/purity) - Validates that components/hooks are pure by checking known-impure functions
31
46
*[`refs`](/reference/eslint-plugin-react-hooks/lints/refs) - Validates correct usage of refs, not reading/writing during render
32
-
*[`rules-of-hooks`](/reference/eslint-plugin-react-hooks/lints/rules-of-hooks) - Validates that components and hooks follow the Rules of Hooks
33
47
*[`set-state-in-effect`](/reference/eslint-plugin-react-hooks/lints/set-state-in-effect) - Validates against calling setState synchronously in an effect
34
48
*[`set-state-in-render`](/reference/eslint-plugin-react-hooks/lints/set-state-in-render) - Validates against setting state during render
35
49
*[`static-components`](/reference/eslint-plugin-react-hooks/lints/static-components) - Validates that components are static, not recreated every render
Copy file name to clipboardExpand all lines: src/content/reference/eslint-plugin-react-hooks/lints/component-hook-factories.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
---
2
2
title: component-hook-factories
3
+
version: rc
3
4
---
4
5
5
6
<Intro>
@@ -8,6 +9,14 @@ Validates against higher order functions defining nested components or hooks. Co
8
9
9
10
</Intro>
10
11
12
+
<RC>
13
+
14
+
This rule is available in the RC version of `eslint-plugin-react-hooks`.
15
+
16
+
You can try it by upgrading the lint plugin [to the most recent RC version](/learn/react-compiler/installation#eslint-integration).
17
+
18
+
</RC>
19
+
11
20
## Rule Details {/*rule-details*/}
12
21
13
22
Defining components or hooks inside other functions creates new instances on every call. React treats each as a completely different component, destroying and recreating the entire component tree, losing all state, and causing performance problems.
Copy file name to clipboardExpand all lines: src/content/reference/eslint-plugin-react-hooks/lints/config.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
---
2
2
title: config
3
+
version: rc
3
4
---
4
5
5
6
<Intro>
@@ -8,6 +9,14 @@ Validates the compiler [configuration options](/reference/react-compiler/configu
8
9
9
10
</Intro>
10
11
12
+
<RC>
13
+
14
+
This rule is available in the RC version of `eslint-plugin-react-hooks`.
15
+
16
+
You can try it by upgrading the lint plugin [to the most recent RC version](/learn/react-compiler/installation#eslint-integration).
17
+
18
+
</RC>
19
+
11
20
## Rule Details {/*rule-details*/}
12
21
13
22
React Compiler accepts various [configuration options](/reference/react-compiler/configuration) to control its behavior. This rule validates that your configuration uses correct option names and value types, preventing silent failures from typos or incorrect settings.
Copy file name to clipboardExpand all lines: src/content/reference/eslint-plugin-react-hooks/lints/error-boundaries.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
---
2
2
title: error-boundaries
3
+
version: rc
3
4
---
4
5
5
6
<Intro>
@@ -8,6 +9,14 @@ Validates usage of Error Boundaries instead of try/catch for errors in child com
8
9
9
10
</Intro>
10
11
12
+
<RC>
13
+
14
+
This rule is available in the RC version of `eslint-plugin-react-hooks`.
15
+
16
+
You can try it by upgrading the lint plugin [to the most recent RC version](/learn/react-compiler/installation#eslint-integration).
17
+
18
+
</RC>
19
+
11
20
## Rule Details {/*rule-details*/}
12
21
13
22
Try/catch blocks can't catch errors that happen during React's rendering process. Errors thrown in rendering methods or hooks bubble up through the component tree. Only [Error Boundaries](/reference/react/Component#catching-rendering-errors-with-an-error-boundary) can catch these errors.
Copy file name to clipboardExpand all lines: src/content/reference/eslint-plugin-react-hooks/lints/gating.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
---
2
2
title: gating
3
+
version: rc
3
4
---
4
5
5
6
<Intro>
@@ -8,6 +9,14 @@ Validates configuration of [gating mode](/reference/react-compiler/gating).
8
9
9
10
</Intro>
10
11
12
+
<RC>
13
+
14
+
This rule is available in the RC version of `eslint-plugin-react-hooks`.
15
+
16
+
You can try it by upgrading the lint plugin [to the most recent RC version](/learn/react-compiler/installation#eslint-integration).
17
+
18
+
</RC>
19
+
11
20
## Rule Details {/*rule-details*/}
12
21
13
22
Gating mode lets you gradually adopt React Compiler by marking specific components for optimization. This rule ensures your gating configuration is valid so the compiler knows which components to process.
Copy file name to clipboardExpand all lines: src/content/reference/eslint-plugin-react-hooks/lints/globals.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
---
2
2
title: globals
3
+
version: rc
3
4
---
4
5
5
6
<Intro>
@@ -8,6 +9,14 @@ Validates against assignment/mutation of globals during render, part of ensuring
8
9
9
10
</Intro>
10
11
12
+
<RC>
13
+
14
+
This rule is available in the RC version of `eslint-plugin-react-hooks`.
15
+
16
+
You can try it by upgrading the lint plugin [to the most recent RC version](/learn/react-compiler/installation#eslint-integration).
17
+
18
+
</RC>
19
+
11
20
## Rule Details {/*rule-details*/}
12
21
13
22
Global variables exist outside React's control. When you modify them during render, you break React's assumption that rendering is pure. This can cause components to behave differently in development vs production, break Fast Refresh, and make your app impossible to optimize with features like React Compiler.
0 commit comments