eslint报错

412 阅读1分钟

问题一:运行时报了一堆关于eslint的错

Trailing spaces not allowed no-trailing-spaces template模板中的空格导致的

image.png

expected indentation of 0 spaces but found 2 首行缩进空格导致的

Unexpected trailing comma. 内容最后加了逗号引起的

image.png

以上问题的解决: 在项目根目录找到.eslintrc.js文件,往rules中写入以下规则

"no-irregular-whitespace": "off",
"indent": ["off", 2],
"no-tabs":"off"

image.png image.png 问题二:vue项目编译报错Component name “My“ should always be multi-word vue/multi-word-component-names

image.png 解决:在项目根目录找到vue.config.js文件,在末尾加入这一行代码 lintOnSave: false,关闭组件名字的检查

lintOnSave: false

image.png