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

Comments

Projects
None yet
5 participants
@kobezzza

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 label Jul 27, 2016

@mysticatea mysticatea added question and removed triage labels Jul 27, 2016

@mysticatea

This comment has been minimized.

Show comment
Hide comment
@mysticatea

mysticatea Jul 27, 2016

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.

Member

mysticatea commented Jul 27, 2016

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.

@mysticatea mysticatea closed this Jul 27, 2016

@kobezzza

This comment has been minimized.

Show comment
Hide comment
@kobezzza

kobezzza Jul 27, 2016

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

kobezzza commented Jul 27, 2016

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

@adiachenko

This comment has been minimized.

Show comment
Hide comment
@adiachenko

adiachenko Jul 30, 2016

@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.

adiachenko commented Jul 30, 2016

@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

This comment has been minimized.

Show comment
Hide comment
@mysticatea

mysticatea Jul 30, 2016

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: acornjs/acorn#441
  2. Our parser supports those: eslint/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.
Member

mysticatea commented Jul 30, 2016

@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: acornjs/acorn#441
  2. Our parser supports those: eslint/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

This comment has been minimized.

Show comment
Hide comment
@hzoo
Member

hzoo commented Jul 30, 2016

@eslint eslint bot locked and limited conversation to collaborators Feb 6, 2018

@eslint eslint bot added the archived due to age label Feb 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.