Tell us about your environment
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'
@willin you have to add to parserOptions: ecmaVersion: 7
ofcourse. in dwing
Async functions have been added in ECMAScript 2017. You have to have ecmaVersion: 2017 or ecmaVersion: 8.
@armano2 @mysticatea @michalsnik Are you sure? I'm always using ecmaVersion: 2017, but this error still occurs.
@JounQin I'm sure because I implemented it.
@mysticatea Please check https://github.com/JounQin/eslint-plugin-vue/tree/async_issue , just run npn run test
/local/GitHub/eslint-plugin-vue/tests/integrations/eslint-plugin-import/a.vue
6:15 warning Parse errors in imported module './b.vue': Unexpected token test (8:10) import/namespace
6:15 warning Parse errors in imported module './b.vue': Unexpected token test (8:10) import/default
✖ 2 problems (0 errors, 2 warnings)
@JounQin ES2015 does not support async functions.
Emm... OK, I found out maybe there is something error in my eslint configuration. thx any way
Most helpful comment
Async functions have been added in ECMAScript 2017. You have to have
ecmaVersion: 2017orecmaVersion: 8.