Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ESLint parsing error when using arrow syntax with async

Tags:

eslint

I'm using ESLint to analyze my code. The code runs fine, but I get this error from eslint:

[eslint] Parsing error: Unexpected token t

(parameter) t: any

test.serial('set: Handles save error', async t => {
  // function definition
});

Here's .eslintrc.js

module.exports = {
  extends: 'google',
  parserOptions: {
    ecmaVersion: 6
  }
};
like image 486
Doug Knesek Avatar asked Jun 10 '17 20:06

Doug Knesek


2 Answers

async/await is an ECMAScript 2017 feature, so if you change ecmaVersion: 8 instead of 6, this should work!

like image 135
btmills Avatar answered Nov 06 '22 09:11

btmills


I had a similar problem and solve editing the package.json line 5.

I removed " ." that's after "eslint" and everything is fine now.

like image 36
Airton LUCIANO Aragão Avatar answered Nov 06 '22 10:11

Airton LUCIANO Aragão