Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

"Unexpected Token" for async arrow IIFE #245

Closed
spalger opened this issue Feb 1, 2016 · 3 comments
Closed

"Unexpected Token" for async arrow IIFE #245

spalger opened this issue Feb 1, 2016 · 3 comments

Comments

@spalger
Copy link

spalger commented Feb 1, 2016

Using eslint 4.1.7 I am getting a syntax error with this code:

(async () => {

}());

Unexpected token at line 3 col 2

@spalger spalger changed the title "Unexpected Token" for async IIFE "Unexpected Token" for async arrow IIFE Feb 1, 2016
@spalger
Copy link
Author

spalger commented Feb 1, 2016

This only occurs on arrow functions. (async function () {}()); works fine.

spalger added a commit to spalger/kibana that referenced this issue Feb 1, 2016
elasticsearch-bot pushed a commit to elastic/kibana that referenced this issue Feb 1, 2016
elasticsearch-bot pushed a commit to elastic/kibana that referenced this issue Feb 1, 2016
elasticsearch-bot pushed a commit to elastic/kibana that referenced this issue Feb 1, 2016
@jmm
Copy link
Member

jmm commented Feb 1, 2016

I don't think that input is valid. AsyncArrowFunction is an AssignmentExpression like ArrowFunction and this is a syntax error:

() => {}();

It has to be

(() => {})();

There was a bug in Babel 5.x that allowed the former, but apparently it doesn't extend to async arrows.

@spalger
Copy link
Author

spalger commented Feb 1, 2016

hmm, interesting

@spalger spalger closed this as completed Feb 1, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants