question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parsing error: Unexpected token =>

See original GitHub issue

code:

const task = (fn) => async () => {
    const start = new Date();
    console.log(`[${format(start)}] Starting '${fn.name}'...`);
    await fn();
    const end = new Date();
    const time = end.getTime() - start.getTime();
    console.log(`[${format(end)}] Finished '${fn.name}' after ${time}ms`);
};

error:

error  Parsing error: Unexpected token =>

config:

airbnb/base (eslint-config-airbnb@2.1.1, eslint@1.10.3)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
vadimcodercommented, Mar 22, 2017

@dwang68 I have 'ecmaVersion': 8 and it works. So first I would suggest to set 8 and see.

0reactions
ilyavolodincommented, Mar 22, 2017

async/await are part of es2017 spec (i.e. ecmaVersion: 8). es2016 only added one syntax change to the language - ** operator.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint Parsing error: Unexpected token - Stack Overflow
Unexpected token errors in ESLint parsing occur due to incompatibility between your development environment and ESLint's current parsing ...
Read more >
3 Easy Steps to Fix the Parsing Error Unexpected Token issue
The Parsing error unexpected token usually occurs when there is an incompatibility between the parser option and the code.
Read more >
ESLint: "Parsing error: Unexpected token" in Visual Studio Code
Unexpected token errors are caused by incompatibilities in your parser options and the code you're writing. In this case, I'm using a number...
Read more >
[ESLint] Parsing error: unexpected token - DEV Community ‍ ‍
What is this article about? This is a solution when I saw these errors. Warning: React version not specified in eslint-plugin-react settings. ...
Read more >
Parsing Error: Unexpected Token ; - ServiceNow Community
I am trying to create a business rule that requires a field in a child table/record to be mandatory when certain fields in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found