diff --git a/beta/package.json b/beta/package.json index de26b348..4602d85a 100644 --- a/beta/package.json +++ b/beta/package.json @@ -65,7 +65,7 @@ "eslint-plugin-import": "2.x", "eslint-plugin-jsx-a11y": "6.x", "eslint-plugin-react": "7.x", - "eslint-plugin-react-hooks": "2.x", + "eslint-plugin-react-hooks": "experimental", "fs-extra": "^9.0.1", "globby": "^11.0.1", "gray-matter": "^4.0.2", diff --git a/beta/src/content/learn/escape-hatches.md b/beta/src/content/learn/escape-hatches.md index 5e01c5c8..2c8f1e87 100644 --- a/beta/src/content/learn/escape-hatches.md +++ b/beta/src/content/learn/escape-hatches.md @@ -489,7 +489,7 @@ function ChatRoom({ roomId, theme }) { }); connection.connect(); return () => connection.disconnect(); - }, [roomId, onConnected]); // TODO: Linter will allow [roomId] in the future + }, [roomId]); return

Welcome to the {roomId} room!

} diff --git a/beta/src/content/learn/removing-effect-dependencies.md b/beta/src/content/learn/removing-effect-dependencies.md index 27c4aa44..5e9af4d8 100644 --- a/beta/src/content/learn/removing-effect-dependencies.md +++ b/beta/src/content/learn/removing-effect-dependencies.md @@ -1414,7 +1414,7 @@ function Welcome({ duration }) { return () => { animation.stop(); }; - }, [onAppear]); // TODO: Linter will allow [] in the future + }, []); return (

onReceiveMessage(msg)); connection.connect(); return () => connection.disconnect(); - }, [roomId, isEncrypted, onReceiveMessage]); // TODO: Linter will allow [roomId, isEncrypted] in the future + }, [roomId, isEncrypted]); return

Welcome to the {roomId} room!

; } diff --git a/beta/src/content/learn/reusing-logic-with-custom-hooks.md b/beta/src/content/learn/reusing-logic-with-custom-hooks.md index 134e1509..f54b3923 100644 --- a/beta/src/content/learn/reusing-logic-with-custom-hooks.md +++ b/beta/src/content/learn/reusing-logic-with-custom-hooks.md @@ -1002,7 +1002,7 @@ export function useChatRoom({ serverUrl, roomId, onReceiveMessage }) { onMessage(msg); }); return () => connection.disconnect(); - }, [roomId, serverUrl, onMessage]); // TODO: Linter will allow [roomId, serverUrl] + }, [roomId, serverUrl]); } ``` @@ -1673,7 +1673,7 @@ function useAnimationLoop(isRunning, drawFrame) { tick(); return () => cancelAnimationFrame(frameId); - }, [isRunning, onFrame]); // TODO: Linter will allow [isRunning] in the future + }, [isRunning]); } ``` @@ -2306,7 +2306,7 @@ export function useInterval(callback, delay) { useEffect(() => { const id = setInterval(onTick, delay); return () => clearInterval(id); - }, [delay, onTick]); // TODO: Linter will allow [delay] in the future + }, [delay]); } ``` diff --git a/beta/src/content/learn/separating-events-from-effects.md b/beta/src/content/learn/separating-events-from-effects.md index 6d8881a5..cddd9e47 100644 --- a/beta/src/content/learn/separating-events-from-effects.md +++ b/beta/src/content/learn/separating-events-from-effects.md @@ -482,7 +482,7 @@ function ChatRoom({ roomId, theme }) { }); connection.connect(); return () => connection.disconnect(); - }, [roomId, onConnected]); // TODO: Linter will allow [roomId] in the future + }, [roomId]); return

Welcome to the {roomId} room!

} @@ -813,7 +813,7 @@ export default function App() { useEffect(() => { window.addEventListener('pointermove', onMove); return () => window.removeEventListener('pointermove', onMove); - }, [onMove]); // TODO: Linter will allow [] in the future + }, []); return ( <> @@ -1172,7 +1172,7 @@ export default function Timer() { return () => { clearInterval(id); }; - }, [onTick]); // TODO: Linter will allow [] in the future + }, []); return ( <> @@ -1342,7 +1342,7 @@ export default function Timer() { return () => { clearInterval(id); } - }, [delay, onTick]); // TODO: Linter will allow [delay] in the future + }, [delay]); return ( <> @@ -1441,7 +1441,7 @@ function ChatRoom({ roomId, theme }) { }); connection.connect(); return () => connection.disconnect(); - }, [roomId, onConnected]); // TODO: Linter will allow [roomId] in the future + }, [roomId]); return

Welcome to the {roomId} room!

} @@ -1582,7 +1582,7 @@ function ChatRoom({ roomId, theme }) { }); connection.connect(); return () => connection.disconnect(); - }, [roomId, onConnected]); // TODO: Linter will allow [roomId] in the future + }, [roomId]); return

Welcome to the {roomId} room!

} @@ -1725,7 +1725,7 @@ function ChatRoom({ roomId, theme }) { clearTimeout(notificationTimeoutId); } }; - }, [roomId, onConnected]); // TODO: Linter will allow [roomId] in the future + }, [roomId]); return

Welcome to the {roomId} room!

} diff --git a/beta/yarn.lock b/beta/yarn.lock index 6e803535..a76dfbf7 100644 --- a/beta/yarn.lock +++ b/beta/yarn.lock @@ -2500,16 +2500,16 @@ eslint-plugin-jsx-a11y@6.x, eslint-plugin-jsx-a11y@^6.4.1: language-tags "^1.0.5" minimatch "^3.0.4" -eslint-plugin-react-hooks@2.x: - version "2.5.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.5.1.tgz#4ef5930592588ce171abeb26f400c7fbcbc23cd0" - integrity sha512-Y2c4b55R+6ZzwtTppKwSmK/Kar8AdLiC2f9NADCuxbcTgPPg41Gyqa6b9GppgXSvCtkRw43ZE86CT5sejKC6/g== - eslint-plugin-react-hooks@^4.2.0: version "4.3.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.3.0.tgz#318dbf312e06fab1c835a4abef00121751ac1172" integrity sha512-XslZy0LnMn+84NEG9jSGR6eGqaZB3133L8xewQo3fQagbQuGt7a63gf+P1NGKZavEYEC3UXaWEAA/AqDkuN6xA== +eslint-plugin-react-hooks@experimental: + version "0.0.0-experimental-cb5084d1c-20220924" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-0.0.0-experimental-cb5084d1c-20220924.tgz#66847d4c458198a1a38cbf437397dd461bfa7245" + integrity sha512-qk195a0V1Fz82DUESwAt8bSxwV3MBYGUh4cWezY21gaWderOcva8SdC6HNMAwk2Ad/HvaJbjp/qLYrYBQW7pGg== + eslint-plugin-react@7.x, eslint-plugin-react@^7.23.1: version "7.28.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.28.0.tgz#8f3ff450677571a659ce76efc6d80b6a525adbdf"