-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Bug: Cannot read property 'references' of undefined in eslint-plugin-react-hooks v4.0.5 #19243
Labels
Comments
lencioni
added
the
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
label
Jul 2, 2020
Thanks for the report. Would you like to look into a fix? |
gaearon
added
Component: ESLint Rules
Type: Bug
and removed
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
labels
Jul 2, 2020
lencioni
added a commit
to lencioni/react
that referenced
this issue
Jul 6, 2020
Certain code patterns using optional chaining syntax causes eslint-plugin-react-hooks to throw an error. We can avoid the throw by adding some guards. I didn't read through the code to understand how it works, I just added a guard to every place where it threw, so maybe there is a better fix closer to the root cause than what I have here. In my test case, I noticed that the optional chaining that was used in the code was not included in the suggestions description or output, but it seems like it should be. This might make a nice future improvement on top of this fix, so I left a TODO comment to that effect. Fixes facebook#19243
lencioni
added a commit
to lencioni/react
that referenced
this issue
Jul 6, 2020
Certain code patterns using optional chaining syntax causes eslint-plugin-react-hooks to throw an error. We can avoid the throw by adding some guards. I didn't read through the code to understand how it works, I just added a guard to every place where it threw, so maybe there is a better fix closer to the root cause than what I have here. In my test case, I noticed that the optional chaining that was used in the code was not included in the suggestions description or output, but it seems like it should be. This might make a nice future improvement on top of this fix, so I left a TODO comment to that effect. Fixes facebook#19243
bvaughn
pushed a commit
that referenced
this issue
Jul 6, 2020
Certain code patterns using optional chaining syntax causes eslint-plugin-react-hooks to throw an error. We can avoid the throw by adding some guards. I didn't read through the code to understand how it works, I just added a guard to every place where it threw, so maybe there is a better fix closer to the root cause than what I have here. In my test case, I noticed that the optional chaining that was used in the code was not included in the suggestions description or output, but it seems like it should be. This might make a nice future improvement on top of this fix, so I left a TODO comment to that effect. Fixes #19243
Optional chaining problems should be fixed in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Certain code patterns using optional chaining syntax causes eslint-plugin-react-hooks to throw an error.
React version: 16.10.2
Steps To Reproduce
The current behavior
ESLint throws the following error:
The expected behavior
ESLint does not throw an error.
This looks related to #19043 and #19062.
I've noticed that it does not throw if a number of slight variations are made to the code. The following do not throw:
cc @krailler
The text was updated successfully, but these errors were encountered: