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

🎉 Asynchronous Iteration arrived at Stage 4. #9891

Closed
2 tasks done
mysticatea opened this issue Jan 25, 2018 · 5 comments · Fixed by Urigo/tortilla#62, #9957, mono-js/mono-notifications#5, mono-js/mono-push#5 or terrajs/lib-starter#5
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 new syntax This issue is related to new syntax that has reached stage 4 rule Relates to ESLint's core rules

Comments

@mysticatea
Copy link
Member

mysticatea commented Jan 25, 2018

tc39/proposals@a41dccc

  • Update Espree to support the syntax in ecmaVersion:2018.
    • for await (const x of xs); (ForOfStatement#await)
    • async function* f() {}
    • f = async function* () {}
    • obj = { async* f() {} }
    • class A { async* f() {} }
  • Update core rules to support the syntax.
@mysticatea mysticatea added enhancement This change enhances an existing feature of ESLint accepted There is consensus among the team that this change meets the criteria for inclusion blocked This change can't be completed until another issue is resolved labels Jan 25, 2018
@not-an-aardvark
Copy link
Member

  • object-shorthand fixer needs to account for async generator methods
  • semi needs to account for for-await-of statements
  • keyword-spacing needs to account for for-await-of statements
  • no-await-in-loop needs to account for for-await-of statements (should not report statements in for-await-of loops)
  • no-useless-computed-key fixer needs to account for async generator methods
  • require-await needs to avoid reporting errors if an async function has a for-await-of loop

@slikts
Copy link

slikts commented Jan 30, 2018

I really wish eslint would have a flag similar to V8's --harmony allowing the use of latest language features to avoid situations like this where the actual feature has been usable for almost a year and now is even standardized yet eslint support is lagging.

@mysticatea
Copy link
Member Author

mysticatea commented Jan 30, 2018

@slikts You can use babel-eslint parser to use experimental syntax.

Now it has arrived at Stage 4, so we have implemented it ASAP: acornjs/acorn#660.
We are awaiting the release of acorn, the upstream of our JavaScript parser.

@mysticatea mysticatea added rule Relates to ESLint's core rules and removed blocked This change can't be completed until another issue is resolved labels Feb 4, 2018
@mysticatea
Copy link
Member Author

I'm working on this.

not-an-aardvark pushed a commit that referenced this issue Feb 10, 2018
* update keyword-spacing

* update no-await-in-loop

* update object-shorthand

* update require-await

* update tests of generator-star-spacing

* update tests of no-useless-computed-key
@pkhpkh
Copy link

pkhpkh commented Feb 19, 2018

So, it looks like this changed the detection site for no-await-in-loop in for-of loops with included await statements, e.g.:

1 | for (x of obj) {
2 |  await foo(x);
3 | }

from the await statement to the loop. (In the example, moved from (2) to (1). This makes sense for for-await-of loops, but seems surprising in a for-of loop.

Is this intentional, or a bug?

This was referenced Mar 19, 2018
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Aug 10, 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 Aug 10, 2018
@mysticatea mysticatea added the new syntax This issue is related to new syntax that has reached stage 4 label Dec 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.