在ant design+vue项目中一直提示
You may use special comments to disable some warnings. Use // eslint-disable-next-line to ignore the next line. Use /* eslint-disable */ to ignore all warnings in a file.
错误类型,每次报错的时候显示你的代码中出现很多个不符合规范代码的写法,多空格,或者少空格的问题,虽然是warning,但是看着很不舒服。
630 errors and 140 warnings found. 628 errors and 140 warnings potentially fixable with the `--fix` option.
本来想着是把格式都按照提示要求改一下,但是改了半小时,报错数目基本上没有改变,这可不行啊,干脆去掉吧,
解决方法:
把代码规范器关掉:
关闭 Eslint (不推荐) 移除 package.json
中 eslintConfig
整个节点代码, vue.config.js
下的 lintOnSave
值改为 false
希望能力在提升很多,完全会使用代码规范器eslint,或者某一天有个大神看到我的博客说,你这虽然省事,但是培养不了好的代码规范的习惯,我教你一种快捷更改这些warning的方法,期待期待期待,放码过来啊!!!
我先把我在package.json文件中删掉的部分报错起来吧
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/strongly-recommended",
"@vue/standard"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {
"generator-star-spacing": "off",
"no-mixed-operators": 0,
"vue/max-attributes-per-line": [
2,
{
"singleline": 5,
"multiline": {
"max": 1,
"allowFirstLine": false
}
}
],
"vue/attribute-hyphenation": 0,
"vue/html-self-closing": 0,
"vue/component-name-in-template-casing": 0,
"vue/html-closing-bracket-spacing": 0,
"vue/singleline-html-element-content-newline": 0,
"vue/no-unused-components": 0,
"vue/multiline-html-element-content-newline": 0,
"vue/no-use-v-if-with-v-for": 0,
"vue/html-closing-bracket-newline": 0,
"vue/no-parsing-error": 0,
"no-console": 0,
"no-tabs": 0,
"quotes": [
2,
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"semi": [
2,
"never",
{
"beforeStatementContinuationChars": "never"
}
],
"no-delete-var": 2,
"prefer-const": [
2,
{
"ignoreReadBeforeAssign": false
}
]
}
},