Vue error: Parsing error: Unexpected token

参考内容:
Vue eslint-plugin-vue  https://eslint.vuejs.org/user-guide/#installation

解决方法:

  1. 确认安装eslint-plugin-vue依赖,具体可以查看上面链接;
  2. .eslint.js配置文件中添加如下配置:
 1 module.exports = {
 2   root: true,
 3   env: {
 4     browser: true,
 5     node: true,
 6     es6: true,
 7   },
 8   parser: 'vue-eslint-parser',
 9   parserOptions: {
10     sourceType: 'module',
11   },
12   rules: {
13     indent: ['off', 2],
14     'no-tabs': 'off',
15     semi: [0],
16     'no-mixed-spaces-and-tabs': [0],
17     singleQuote: 0,
18     'space-before-function-paren': 0,
19     'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
20     'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
21   },
22 }

 

posted @ 2020-05-21 17:28  haha-uu  阅读(2323)  评论(0编辑  收藏  举报