vue项目报错Trailing spaces not allowed.

vue项目报错Trailing spaces not allowed.

是因为vue-cli的eslint的语法规范导致的

你可以把eslint给关闭了

在使用vue-cli脚手架来生成vue项目文件的时候,会发现有个自带的代码规范eslint,非常麻烦,其实你只要找到.eslintrc.js里面,把standard给注释了就好了,或者是vue-standard给注释了,如下

module.exports = {
  root: true,
  parserOptions: {
    parser: 'babel-eslint'
  },
  env: {
    browser: true,
  },
  extends: [
    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
    // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
    'plugin:vue/essential', 
    // https://github.com/standard/standard/blob/master/docs/RULES-en.md
    // 'standard'
  ],
  // required to lint *.vue files
  plugins: [
    'vue'
  ],
  // add your custom rules here
  rules: {
    // allow async-await
    'generator-star-spacing': 'off',
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-unused-vars': 0
  }
posted @ 2021-02-23 08:55  疯子110  阅读(577)  评论(0编辑  收藏  举报