-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
no-unused-vars-before-return does not detect use as React element #16418
Comments
Thank you for reporting this issue @rmccue.
I guess the way to fix the problem, would be to inside the loop that that iterates on the variables: Query all JSX element tags with name equal to that variable |
In revisiting the logic, I see it does not consider the use in the JSX as a "reference" at this line: To me, this seems like an error in the parser, as quite clearly it is a reference to the variable. Two thoughts:
|
I'm not sure it would have any impact, but it would be worth some quick testing to see whether bumping dependencies versions would make any difference here, if indeed it's an issue with the parse result. Specifically thinking one of |
related: eslint/eslint#12117 according to that issue,
|
If I am not mistaken this is working as expected nowadays. |
Testing this today, it appears to still report a false positive. Per #16418 (comment), we are now running |
Fix at #21358 seeks to account for this manually. |
The following code is incorrectly triggering a
no-unused-vars-before-return
error:I suspect the rule is failing to detect the React element as usage of the variable.
The text was updated successfully, but these errors were encountered: