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

I got an reserved word error for await statements #884

Closed
rbecheras opened this issue May 11, 2017 · 3 comments

Comments

@rbecheras
Copy link

commented May 11, 2017

I posted an issue on atom linter-js-standard plugin, but I guess it is most likely an issue with standard itself:

ricardofbarros/linter-js-standard#185

capture d ecran de 2017-05-11 22-18-44

But I use linter-js-standard v3.9.1:

capture d ecran de 2017-05-11 22-19-36

Which use standard v8.6.0 as dependency

https://github.com/ricardofbarros/linter-js-standard/blob/master/package.json

And standard seems support async/await since standard v8.3.0 (> v8.6.0)

#645 (comment)

capture d ecran de 2017-05-11 22-22-38

What's wrong ?

@Flet

This comment has been minimized.

Copy link
Member

commented Jun 8, 2017

Hello!

I think this is working normally. The error isn't very informative, but the await keyword can only be used inside of a function marked async. So the sample above is correctly marked as an error.
https://ponyfoo.com/articles/understanding-javascript-async-await#using-async-await

Just for kicks, I checked out the v8.6.0 tag and tried another sample file with different syntax, and it worked! :)

~/code/standard v8.6.0*
🕦 ❯ cat test.js
/* global foo */

async function yo () {
  let x = await foo()
  return x
}

module.exports = yo
~/code/standard v8.6.0*
🕦 ❯ node bin/cmd.js test.js
🕦 ❯ # no error returned!

I'm going to close this issue, but please feel free to continue the conversation.

@brianmhunt

This comment has been minimized.

Copy link

commented Sep 13, 2017

I think the issue here is that the message is misleading / not as informative as it could be .

It would be better (and properly informative) if it said "The 'await' keyword can only be used inside functions marked 'async'."

@Flet

This comment has been minimized.

Copy link
Member

commented Sep 13, 2017

I agree @brianmhunt, however the error originates from deep inside eslints parser.

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.