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 }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM