webstorm 开发vue.js项目总提示空格报错

 webstorm总是提示空格报错,然后怎么删除都不行

 看了下网上的 方法,修改.eslintrc.js

// https://eslint.org/docs/user-guide/configuring

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',
    'html'    //这里加上html就可以了,不要忘记在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'
  }
}

但是加上之后提示:

 好吧,接着处理这个问题,提示是无法无法找到module 'eslint-plugin-html',执行如下命令:

npm install eslint-plugin-html

然而还是报错,崩溃中,然后尝试方法关闭Eslint的代码检查,修改build路径下的webpack.base.conf.js文件,找到createLintingRule方法,然后屏蔽所有的内容。

const createLintingRule = () => ({
  //test: /\.(js|vue)$/,
  //loader: 'eslint-loader',
  //enforce: 'pre',
  //include: [resolve('src'), resolve('test')],
  //options: {
  //formatter: require('eslint-friendly-formatter'),
  //emitWarning: !config.dev.showEslintErrorsInOverlay
  //}
})

然后重启项目,可以了

猜你喜欢

转载自blog.csdn.net/lancelots/article/details/84635512