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

[Bug] Async function declaration #6773

Closed
kobezzza opened this issue Jul 27, 2016 · 5 comments
Closed

[Bug] Async function declaration #6773

kobezzza opened this issue Jul 27, 2016 · 5 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint

Comments

@kobezzza
Copy link

kobezzza commented Jul 27, 2016

eslint 3.1.1
"parser": "babel-eslint"

export async function main() {

}

Output:

Cannot read property 'value' of undefined
TypeError: Cannot read property 'value' of undefined
    at getStarToken (C:\Users\kobez\Documents\dev\TravelChat\node_modules\eslint\lib\rules\generator-star-spacing.js:68:25)
    at EventEmitter.checkFunction (C:\Users\kobez\Documents\dev\TravelChat\node_modules\eslint\lib\rules\generator-star-spacing.js:123:29)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:188:7)
    at NodeEventGenerator.enterNode (C:\Users\kobez\Documents\dev\TravelChat\node_modules\eslint\lib\util\node-event-generator.js:40:22)
    at CodePathAnalyzer.enterNode (C:\Users\kobez\Documents\dev\TravelChat\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:607:23)
    at CommentEventGenerator.enterNode (C:\Users\kobez\Documents\dev\TravelChat\node_modules\eslint\lib\util\comment-event-generator.js:97:23)
    at Controller.traverser.traverse.enter (C:\Users\kobez\Documents\dev\TravelChat\node_modules\eslint\lib\eslint.js:902:36)
    at Controller.__execute (C:\Users\kobez\Documents\dev\TravelChat\node_modules\eslint\node_modules\estraverse\estraverse.js:397:31)
    at Controller.traverse (C:\Users\kobez\Documents\dev\TravelChat\node_modules\eslint\node_modules\estraverse\estraverse.js:501:28)

Process finished with exit code 1

With

export const main = async () => {

};

All fine.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jul 27, 2016
@mysticatea mysticatea added question This issue asks a question about ESLint and removed triage An ESLint team member will look at this issue soon labels Jul 27, 2016
@mysticatea
Copy link
Member

Thank you for this issue.

Async functions are not a part of JavaScript yet (it's a proposal).
You can use babel-eslint and eslint-plugin-babel in order to use such features.

Especially, you can use babel/generator-star-spacing rule for that error.

@kobezzza
Copy link
Author

kobezzza commented Jul 27, 2016

@mysticatea i always use babel-eslint, and ESlint crashes. Toggle off generator-star-spacing fixed it, thanks.

@adiachenko
Copy link

@mysticatea Async functions proposal has been moved to stage 4. I don't know if I'm correct but I seem to have read somewhere that you may support stage 4 proposals.

@mysticatea
Copy link
Member

@adiachenko It happened after this issue. 😄

Now we are working for supports of the new stage 4 features.
We need several steps.

  1. Acorn, the base of our parser, supports those: Work on ECMAScript 2017? acornjs/acorn#441
  2. Our parser supports those: async function and await expression! espree#287
  3. Then, ESLint rules support those.
    Actually, wrong AST nodes of babel-eslint cause the error, I think. So we cannot fix rules before our parser supports those.

@hzoo
Copy link
Member

hzoo commented Jul 30, 2016

@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
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint
Projects
None yet
Development

No branches or pull requests

5 participants