I am getting the following error in async usage on ESLINT.
eslint Parsing error: Unexpected token function with async
Here is my eslintsrc
{   "extends": "airbnb-base",   "rules": {     "no-console": "off",     "func-style":"error",     "import/no-extraneous-dependencies": ["error", {"devDependencies": false, "optionalDependencies": false, "peerDependencies": false, "packageDir": "./"}] }, "parserOptions": {   "ecmaVersion":8  } }   UPDATE
Here is my async
const get = async function get(req, res) {   const user = await service.get();   console.log("From db",user.username);   res.send('ok'); }; 
                I was getting this error also, I added the following to my eslintrc:
{   "env": {     "node": true,     "es6": true   },    "parserOptions": {     "ecmaVersion": 8   } } 
                        In my case it got fixed when I just changed from:
"parserOptions": { "ecmaVersion": 8 }
to
"parserOptions": { "ecmaVersion": 2018 }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With