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.

Unexpected token after `async`

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.3
  • eslint-plugin-vue Version: 3.11.0
  • Node Version: 8.1.4

Please show your full configuration:

module.exports = {
  root: true,
  extends: [
    'dwing',
    'plugin:vue/recommended'
  ],
  rules: {
    'global-require': 0,
    'import/extensions': [2, 'always', { js: 'never', vue: 'never' }]
  },
  settings: {
    'import/resolver': {
      webpack: {
        config: 'build/webpack.config.js'
      }
    }
  }
};

What did you do? Please include the actual source code causing the issue.

const actions = {
  async getAllData({ commit }) {
    await this.getAllData();
  }
};

export default actions;
// or this 
export const getAllData = async ({ commit }) => {
   await this.getAllData();
}

What did you expect to happen?

What actually happened? Please include the actual, raw output from ESLint.

file: 'file:///Users/willin/Desktop/vuetify-demo/src/store/actions.js' severity: '错误' message: 'Parsing error: Unexpected token getAllData' at: '2,9' source: 'eslint'

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
mysticateacommented, Aug 13, 2017

Async functions have been added in ECMAScript 2017. You have to have ecmaVersion: 2017 or ecmaVersion: 8.

2reactions
mysticateacommented, Oct 20, 2017

@JounQin I’m sure because I implemented it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: Unexpected token function - Async Await Nodejs
I tried to use Babel as Quentin suggested, But, I am getting the following error still. Updated Code- require("babel-core/register"); require("babel-polyfill"); ...
Read more >
Unexpected token error after adding await keyword to ...
Dylan Sather (Pipedream) : Hi , getting used to async / await and asynchronous programming in JS can take a long time even...
Read more >
SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >
SyntaxError: Unexpected token function - Async Await Nodejs
JavaScript : SyntaxError: Unexpected token function - Async Await Nodejs [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] ...
Read more >
Async unexpected token function - App Platform
I'm writing a client side app for freshworks crm. I'm getting error on pack and validate. Its been running fine with “fdk run”...
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