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