创建项目后,执行了npm run eject显示隐藏文件,安装了eslint-config-airbnb-base,然后创建了三个文件.editorconfig、.eslintignore、.eslintrc.js,结果atom报错,开启开发工具看,报错是
D:\UPUPW\htdocs\LotteryAPP_MS\01Code\partner_react\node_modules\eslint-config-airbnb-base\rules\style.js:
Configuration for rule "indent" is invalid:
Value "[object Object]" should NOT have additional properties.
几个文件内容如下
.editorconfig
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
.eslintignore
public/*.js
config/*.js
scripts/*.js
.eslintrc.js
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
},
extends: 'airbnb-base',
// required to lint *.vue files
plugins: [
'react'
],
// add your custom rules here
'rules': {
'import/extensions': ['error', 'always', {
'js': 'never',
}],
'radix': 0,
'global-require': 0,
'import/no-dynamic-require': 0,
},
"env": {
"browser": true
},
"globals": {
},
}
求教这是为什么
似乎是eslint版本问题,我重新create-react-app,创建的项目eslint及其相关包的版本都是不同的,此时再用eslint-config-airbnb-base就正常了
之前的eslint相关包的版本
重新生成的项目中eslint相关包的版本