-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up lint warnings #3612
Clean up lint warnings #3612
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make a ticket to fix the dep array ones? otherwise looks good
we could also start failing the lint job on warnings to help us in the future, but that can be in another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the plan wasn't to ignore the warnings?
@@ -197,6 +197,7 @@ export function useHover(props: HoverProps): HoverResult { | |||
if (isDisabled) { | |||
triggerHoverEnd({currentTarget: state.target}, state.pointerType); | |||
} | |||
// eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed like there are a lot of skip/ignores and I randomly looked at this one. Why didn't we add the other dependencies like state.target
and state.pointerType
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will get handled in a follow-up ticket to review where we ignore this rule
@@ -655,6 +655,7 @@ export function usePress(props: PressHookProps): PressResult { | |||
useEffect(() => { | |||
return () => { | |||
if (!allowTextSelectionOnPress) { | |||
// eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And too followup on me trying to understand the ignores. I thought react-hooks/exhaustive-deps
is about dependencies and useEffect/useLayoutEffect issues? This line looks like a function call. Looking at the lint warning it mentioned dependencies, but seemed to indicate the code should be wrapped in a useEffect/useLayoutEffect or something equivalent. Is this the correct label for the ignore or can we solve it without ignoring it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warning was:
The ref value 'ref.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy 'ref.current' to a variable inside the effect, and use that variable in the cleanup function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on @snowystinger's suggestion to eventually fix those dep arrays, and so that this also doesn't become a pattern.
Build successful! 🎉 |
Picking up from #1199
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: