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

Update: no-extra-parens supports async/await (refs #7101) #7178

Merged
merged 1 commit into from Sep 20, 2016

Conversation

mysticatea
Copy link
Member

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

Tell us about your environment

  • ESLint Version: master
  • Node Version: 6.3.0
  • npm Version: 3.8.9

What parser (default, Babel-ESLint, etc.) are you using?

  • default

Please show your full configuration:

  • nothing

What did you do? Please include the actual source code causing the issue.

A:

$ echo "async function a() { await (a); }" | eslint --stdin --no-eslintrc --parser-options "ecmaVersion:8" --rule "no-extra-parens:error"

B:

$ echo "async function a() { (await a)(); }" | eslint --stdin --no-eslintrc --parser-options "ecmaVersion:8" --rule "no-extra-parens:error"

What did you expect to happen?

In the case A, it should show an error: "Gratuitous parentheses around expression no-extra-parens".
In the case B, it should not show errors.

What actually happened? Please include the actual, raw output from ESLint.

In the case A, it did not show the error.
In the case B, it showed the following errors:

<text>
  1:22  error  Gratuitous parentheses around expression  no-extra-parens

✖ 1 problem (1 error, 0 warnings)

Please check each item to ensure your pull request is ready:

  • I've read the pull request guide
  • I've included tests for my change
  • I've updated documentation for my change (if appropriate)

What changes did you make? (Give an overview)

This PR adds the supports of await expressions into no-extra-parens.
The precedence of await expression is same as unary expressions: https://tc39.github.io/ecmascript-asyncawait/#UnaryExpression

Semver-minor: this is a bug fix which increases errors.

Is there anything you'd like reviewers to focus on?

Nothing in particular.

Refs #7101.

@eslintbot
Copy link

LGTM

@mysticatea mysticatea added bug ESLint is working incorrectly rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion labels Sep 17, 2016
Copy link
Member

@platinumazure platinumazure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but would like another set of eyes on this.

@mysticatea mysticatea mentioned this pull request Sep 17, 2016
12 tasks
@mysticatea mysticatea added the enhancement This change enhances an existing feature of ESLint label Sep 17, 2016
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, just waiting another day.

@nzakas nzakas merged commit 745343f into master Sep 20, 2016
@mysticatea mysticatea deleted the asyncawait/no-extra-parens branch September 20, 2016 20:53
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants