Skip to content
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

Fix ExhaustiveDeps ESLint rule throwing with optional chaining #19260

Merged
merged 1 commit into from
Jul 6, 2020

Commits on Jul 6, 2020

  1. Fix ExhaustiveDeps ESLint rule throwing with optional chaining

    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 committed Jul 6, 2020
    Configuration menu
    Copy the full SHA
    44b93b6 View commit details
    Browse the repository at this point in the history