Browse Source

[Beta] Remove linter TODOs (#5102)

main
dan 2 years ago
committed by GitHub
parent
commit
26fc12cf0a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      beta/package.json
  2. 2
      beta/src/content/learn/escape-hatches.md
  3. 4
      beta/src/content/learn/removing-effect-dependencies.md
  4. 6
      beta/src/content/learn/reusing-logic-with-custom-hooks.md
  5. 14
      beta/src/content/learn/separating-events-from-effects.md
  6. 10
      beta/yarn.lock

2
beta/package.json

@ -65,7 +65,7 @@
"eslint-plugin-import": "2.x", "eslint-plugin-import": "2.x",
"eslint-plugin-jsx-a11y": "6.x", "eslint-plugin-jsx-a11y": "6.x",
"eslint-plugin-react": "7.x", "eslint-plugin-react": "7.x",
"eslint-plugin-react-hooks": "2.x", "eslint-plugin-react-hooks": "experimental",
"fs-extra": "^9.0.1", "fs-extra": "^9.0.1",
"globby": "^11.0.1", "globby": "^11.0.1",
"gray-matter": "^4.0.2", "gray-matter": "^4.0.2",

2
beta/src/content/learn/escape-hatches.md

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

4
beta/src/content/learn/removing-effect-dependencies.md

@ -1414,7 +1414,7 @@ function Welcome({ duration }) {
return () => { return () => {
animation.stop(); animation.stop();
}; };
}, [onAppear]); // TODO: Linter will allow [] in the future }, []);
return ( return (
<h1 <h1
@ -2209,7 +2209,7 @@ export default function ChatRoom({ roomId, isEncrypted, onMessage }) {
connection.on('message', (msg) => onReceiveMessage(msg)); connection.on('message', (msg) => onReceiveMessage(msg));
connection.connect(); connection.connect();
return () => connection.disconnect(); return () => connection.disconnect();
}, [roomId, isEncrypted, onReceiveMessage]); // TODO: Linter will allow [roomId, isEncrypted] in the future }, [roomId, isEncrypted]);
return <h1>Welcome to the {roomId} room!</h1>; return <h1>Welcome to the {roomId} room!</h1>;
} }

6
beta/src/content/learn/reusing-logic-with-custom-hooks.md

@ -1002,7 +1002,7 @@ export function useChatRoom({ serverUrl, roomId, onReceiveMessage }) {
onMessage(msg); onMessage(msg);
}); });
return () => connection.disconnect(); return () => connection.disconnect();
}, [roomId, serverUrl, onMessage]); // TODO: Linter will allow [roomId, serverUrl] }, [roomId, serverUrl]);
} }
``` ```
@ -1673,7 +1673,7 @@ function useAnimationLoop(isRunning, drawFrame) {
tick(); tick();
return () => cancelAnimationFrame(frameId); return () => cancelAnimationFrame(frameId);
}, [isRunning, onFrame]); // TODO: Linter will allow [isRunning] in the future }, [isRunning]);
} }
``` ```
@ -2306,7 +2306,7 @@ export function useInterval(callback, delay) {
useEffect(() => { useEffect(() => {
const id = setInterval(onTick, delay); const id = setInterval(onTick, delay);
return () => clearInterval(id); return () => clearInterval(id);
}, [delay, onTick]); // TODO: Linter will allow [delay] in the future }, [delay]);
} }
``` ```

14
beta/src/content/learn/separating-events-from-effects.md

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

10
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" language-tags "^1.0.5"
minimatch "^3.0.4" 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: eslint-plugin-react-hooks@^4.2.0:
version "4.3.0" version "4.3.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.3.0.tgz#318dbf312e06fab1c835a4abef00121751ac1172" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.3.0.tgz#318dbf312e06fab1c835a4abef00121751ac1172"
integrity sha512-XslZy0LnMn+84NEG9jSGR6eGqaZB3133L8xewQo3fQagbQuGt7a63gf+P1NGKZavEYEC3UXaWEAA/AqDkuN6xA== 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: eslint-plugin-react@7.x, eslint-plugin-react@^7.23.1:
version "7.28.0" version "7.28.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.28.0.tgz#8f3ff450677571a659ce76efc6d80b6a525adbdf" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.28.0.tgz#8f3ff450677571a659ce76efc6d80b6a525adbdf"

Loading…
Cancel
Save