From dfd6494551351de0adbbf049e2314b715e81f68a Mon Sep 17 00:00:00 2001 From: msdlisper <1170167213@qq.com> Date: Sat, 28 Oct 2023 21:40:16 +0800 Subject: [PATCH] fix: bug with useContext/useSyncExternalStore (#609) --- .../rules/use-exhaustive-dependencies.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/website/src/content/docs/linter/rules/use-exhaustive-dependencies.md b/website/src/content/docs/linter/rules/use-exhaustive-dependencies.md index 8df5e9fb8f87..7d85f57acf40 100644 --- a/website/src/content/docs/linter/rules/use-exhaustive-dependencies.md +++ b/website/src/content/docs/linter/rules/use-exhaustive-dependencies.md @@ -49,23 +49,23 @@ function component() {
correctness/useExhaustiveDependencies.js:5:5 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━
✖ This hook does not specify all of its dependencies.
-
+
3 │ function component() {
4 │ let a = 1;
> 5 │ useEffect(() => {
│ ^^^^^^^^^
6 │ console.log(a);
7 │ });
-
+
ℹ This dependency is not specified in the hook dependency list.
-
+
4 │ let a = 1;
5 │ useEffect(() => {
> 6 │ console.log(a);
│ ^
7 │ });
8 │ }
-
+
```jsx
@@ -81,23 +81,23 @@ function component() {
correctness/useExhaustiveDependencies.js:5:5 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━
✖ This hook specifies more dependencies than necessary.
-
+
3 │ function component() {
4 │ let b = 1;
> 5 │ useEffect(() => {
│ ^^^^^^^^^
6 │ }, [b]);
7 │ }
-
+
ℹ This dependency can be removed from the list.
-
+
4 │ let b = 1;
5 │ useEffect(() => {
> 6 │ }, [b]);
│ ^
7 │ }
8 │
-
+
```jsx
@@ -115,23 +115,23 @@ function component() {
correctness/useExhaustiveDependencies.js:5:5 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━
✖ This hook specifies more dependencies than necessary.
-
+
3 │ function component() {
4 │ const [name, setName] = useState();
> 5 │ useEffect(() => {
│ ^^^^^^^^^
6 │ console.log(name);
7 │ setName("");
-
+
ℹ This dependency can be removed from the list.
-
+
6 │ console.log(name);
7 │ setName("");
> 8 │ }, [name, setName]);
│ ^^^^^^^
9 │ }
10 │
-
+
```jsx
@@ -149,23 +149,23 @@ function component() {
correctness/useExhaustiveDependencies.js:6:5 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━
✖ This hook does not specify all of its dependencies.
-
+
4 │ let a = 1;
5 │ const b = a + 1;
> 6 │ useEffect(() => {
│ ^^^^^^^^^
7 │ console.log(b);
8 │ });
-
+
ℹ This dependency is not specified in the hook dependency list.
-
+
5 │ const b = a + 1;
6 │ useEffect(() => {
> 7 │ console.log(b);
│ ^
8 │ });
9 │ }
-
+
## Valid