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: Allow space-unary-ops to handle await expressions #7174

Merged
merged 1 commit into from Sep 20, 2016

Conversation

not-an-aardvark
Copy link
Member

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

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

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)

See #7101 for context. Now that async functions can be parsed by acorn, this fix allows space-unary-ops to detect await expressions.

What rule do you want to change?

space-unary-ops

Does this change cause the rule to produce more or fewer warnings?

More, although it is not expected to break anyone's code since await expressions couldn't be parsed by Espree until a few hours ago.

How will the change be implemented? (New option, new default behavior, etc.)?

This would allow await expressions to be checked by space-unary-ops, in the same manner as yield expressions.
This would work the same way as yield currently does, i.e. await would be part of the words option, and it would be possible to specify {await: true} or {await: false} as an override.

Please provide some example code that this change will affect:

/* eslint space-unary-ops: 2 */

async function foo() {
  await(5); // error: Unary word operator 'await' must be followed by whitespace.
  await (5); // ok
}
/* eslint space-unary-ops: [2, {"words": false}] */

async function foo() {
  await(5); // ok
  await (5); // error: Unexpected space after unary word operator 'await'.
}

What does the rule currently do for this code?

await expressions are currently not linted at all.

What will the rule do after it's changed?

The rule will report await expressions that are not followed by a space (in the same way that it currently reports yield expressions).

What changes did you make? (Give an overview)

(Implements the behavior above)

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

Would this change break cause errors for users who have been using babel-eslint? If so, is it still semver-minor?

@eslintbot
Copy link

LGTM

@mention-bot
Copy link

@not-an-aardvark, thanks for your PR! By analyzing the annotation information on this pull request, we identified @vitorbal, @qmmr and @gyandeeps to be potential reviewers

@eslintbot
Copy link

LGTM

Copy link
Member

@mysticatea mysticatea left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@mysticatea mysticatea added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Sep 17, 2016
@mysticatea mysticatea self-assigned this Sep 17, 2016
@mysticatea
Copy link
Member

Ah, this is an enhancement of space-unary-ops.
So it needs 3 👍s from the team.
I'm a champion.

@platinumazure
Copy link
Member

Endorsed via 👍 to the original PR comment.

@qmmr
Copy link
Contributor

qmmr commented Sep 18, 2016

LGTM 👍

@ilyavolodin ilyavolodin added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Sep 20, 2016
@nzakas nzakas merged commit aaa3779 into eslint:master Sep 20, 2016
@not-an-aardvark not-an-aardvark deleted the space-unary-ops-async branch September 20, 2016 20:48
@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 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

9 participants