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-extra-parens never reports double parens #12127
Comments
CC @mysticatea I'm wondering if this was caused by fee6acb. I did remember seeing some changes in |
@mdjermanovic Thanks for reporting. Any chance you can test with ESLint 6.1.x to make sure the issue isn't present there? |
No, it wasn't that commit (tested with 6.1.0 to be sure), that change to a smarter |
@mdjermanovic Just to confirm, you're saying the issue you reported also is also reproducible in 6.1.0? Thanks! |
Yes, sorry about the confusing post. The same issue is also reproducible in 6.1.0 |
Thanks @mdjermanovic, I've removed the "patch candidate" label based on your last statement. I'm not 100% sure what the intended design of the rule is here. I'm hoping someone else on @eslint/eslint-team might have an idea on how best to handle this issue. |
If this is not the intended design, the problem is with conditionals like this, that doesn't account for double parens: if (hasExcessParens(node.right) && precedence(node.right) >= precedence(node)) {
report(node.right);
} This could be solved by adding |
I think that to handle this issue as a bug makes sense. |
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
Reopening and assigning to myself so that it doesn't get auto closed again. |
Whoops, thanks @platinumazure |
…12697) * Fix: report double extra parens in no-extra-parens (fixes #12127) * rename function, add comments * review feedback * add more test cases * apply cond-assign-exception to test node only * add more checking for double parens * move unaryExpression and exponentiation check * change comments * rebase checkClass, add test case for regression * add invalid test case * add double parens check for for-of, sequence expression
…2127) (eslint#12697) * Fix: report double extra parens in no-extra-parens (fixes eslint#12127) * rename function, add comments * review feedback * add more test cases * apply cond-assign-exception to test node only * add more checking for double parens * move unaryExpression and exponentiation check * change comments * rebase checkClass, add test case for regression * add invalid test case * add double parens check for for-of, sequence expression
Tell us about your environment
same in ESLint 5.16.0, this is not regression.
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
This is not reported because of the precedence:
This is not reported because of the option (does the option allow multiple parens or just one pair?):
There are many examples like this, seems that double parens are never reported whenever a single pair wouldn't be.
What did you expect to happen?
Errors in both cases, I guess.
What actually happened? Please include the actual, raw output from ESLint.
No errors.
Are you willing to submit a pull request to fix this bug?
Yes, if this is indeed a bug. But this needs some analysis and design first, I'm thinking about an additional selector that would catch all double parens regardless of the context.
The text was updated successfully, but these errors were encountered: