vue-cli生成vue项目后添加eslinit报错.
版本如下:
"babel-eslint": "^8.2.1",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
具体配置如下:
// 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'
],
// add your custom rules here
rules: {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
// 通用空格一致
'comma-spacing': 0,
//方法前空格允许
'space-before-function-paren': 0,
// 限制使用单引号,
'quotes': 0,
//不允许行尾有空格
'no-trailing-spaces': 0,
'no-unused-vars': 0,
// 关闭语句强制分号结尾
'semi': [2, 'always'],
//空行最多不能超过100行
'no-multiple-empty-lines': [0, {'max': 100}],
//关闭禁止混用tab和空格
'no-mixed-spaces-and-tabs': [0],
'no-tabs': 0,
'indent': ['error', 'tab'],
//'indent': 0,
//注释空格
'spaced-comment': 0,
//判断无等号
'padded-blocks': 0,
'no-useless-escape': 0
},
"overrides": [
{
"files": ["*.vue"],
"rules": {
"indent": "off",
"vue/script-indent": ["error", 4, {"baseIndent": 4}]
}
}
]
}
报错信息如下:
解决方法已经在官方github上的issue找遍,就连配置里面的overrides都是官方上找到的,现在只能是把ident关闭了
官方github:https://github.com/vuejs/esli...
官方有相关配置项,可修复此问题
链接:script-indent