-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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-sequences doesn't work correctly with assignment in arrow function expression #14572
Comments
Confirmed, This is a bug. Both examples should have the same result, which is no warnings. The intent is for parentheses to indicate the sequence is intentional (reference). |
@jramstedt do you want to submit a pull request to fix this? |
No. |
I can take it if there are no objections. |
This is intended behavior, per #6082. The rule requires double parentheses around arrow function body: /* eslint no-sequences: error */
const test1 = () => ((aa = 123), 10); // error
const test2 = () => (((aa = 123), 10)); // ok |
Wow nice catch. This isn’t obvious from the docs for this rule, so I’d like to leave this open to improve the documentation. This special case should be called out explicitly. |
Node version: v15.5.0
npm version: v7.3.0
Local ESLint version: v7.25.0
Global ESLint version: Not found
Operating System: win32 10.0.19042
@typescript-eslint/parser
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.
What did you expect to happen?
No errors.
What actually happened? Please copy-paste the actual, raw output from ESLint.
Steps to reproduce this issue:
Test the code above.
This code works without errors:
Are you willing to submit a pull request to fix this bug?
The text was updated successfully, but these errors were encountered: