Javascript Eslint报告依赖项配置的eslintrc配置问题
运行下面的lint命令时,我收到了一个弃用警告Javascript Eslint报告依赖项配置的eslintrc配置问题,javascript,node.js,eslint,eslint-config-airbnb,Javascript,Node.js,Eslint,Eslint Config Airbnb,运行下面的lint命令时,我收到了一个弃用警告 eslint src/js/**/*.js src/js/**/*.jsx webpack.config.js --quiet 警告: 不推荐使用警告:[eslint]已不推荐使用“ecmaFeatures”配置文件属性,并且该属性无效。(位于/Users/me/Documents/my project/node_modules/eslint config airbnb/rules/react.js中) 这似乎是在抱怨eslint config
eslint src/js/**/*.js src/js/**/*.jsx webpack.config.js --quiet
警告:
不推荐使用警告:[eslint]已不推荐使用“ecmaFeatures”配置文件属性,并且该属性无效。(位于/Users/me/Documents/my project/node_modules/eslint config airbnb/rules/react.js中)
这似乎是在抱怨eslint config airbnb
中react-a11y.js
和react.js
下列出的文件。这些文件确实包括顶级配置
ecmaFeatures: {
jsx: true
}
这似乎是不正确的:,。但是,似乎()eslint应该忽略node_modules
,无论如何,为了明确起见,我在.eslintignore中添加了以下内容
为什么我会收到节点_模块内问题的警告?我唯一能想到的是忽略列表不包括eslint本身的配置,但这似乎很牵强,它可能会就节点_模块中每个eslintrc文件的过期或错误配置向我发出警告
如果相关,请使用my.eslintrc.json
我如何解决这个问题
编辑:
升级到eslint配置-airbnb@latest
(其中)会导致更严重的错误:
更新babel preset react和eslint插件react,这为我解决了问题。
如果出现新的错误,您将被迫更新几乎所有与eslint相关的内容。由
create-react-app
创建的项目不使用eslint-config-react
。它使用eslint-config-react-app
,这似乎与最新的eslint
和babel-eslint
存在依赖性问题。任何sol为什么?
node_modules/**/*.*
node_modules
{
"env": {
"es6": true,
"browser": true,
"node": true,
"jest": true
},
"extends": ["airbnb", "prettier", "prettier/react"],
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
}
},
"plugins": ["prettier", "react"],
"parser": "babel-eslint",
"rules": {
"no-param-reassign": 0
}
}
/Users/me/Documents/my-project/node_modules/eslint-config-airbnb/rules/react.js:
Configuration for rule "react/jsx-boolean-value" is invalid:
Value "never,[object Object]" should NOT have more than 1 items.
Referenced from: /Users/me/Documents/my-project/node_modules/eslint-config-airbnb/index.js
Referenced from: /Users/me/Documents/my-project/.eslintrc.json
Error: /Users/me/Documents/my-project/node_modules/eslint-config-airbnb/rules/react.js:
Configuration for rule "react/jsx-boolean-value" is invalid:
Value "never,[object Object]" should NOT have more than 1 items.
Referenced from: /Users/me/Documents/my-project/node_modules/eslint-config-airbnb/index.js
Referenced from: /Users/me/Documents/my-project/.eslintrc.json
at validateRuleOptions (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-validator.js:113:15)
at Object.keys.forEach.id (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-validator.js:153:9)
at Array.forEach (native)
at validateRules (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-validator.js:152:30)
at Object.validate (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-validator.js:230:5)
at loadFromDisk (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-file.js:549:19)
at load (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-file.js:592:20)
at configExtends.reduceRight (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-file.js:421:36)
at Array.reduceRight (native)
at applyExtends (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-file.js:403:28)