当我尝试添加时eslint-config-airbnb
出现此错误
$ npm install --save-dev eslint-config-airbnb
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint-plugin-react-hooks
npm ERR! eslint-plugin-react-hooks@"^5.0.0" from [email protected]
npm ERR! node_modules/eslint-config-next
npm ERR! dev eslint-config-next@"15.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev eslint-config-airbnb@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint-plugin-react-hooks
npm ERR! peer eslint-plugin-react-hooks@"^4.3.0" from [email protected]
npm ERR! node_modules/eslint-config-airbnb
npm ERR! dev eslint-config-airbnb@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
正如他们的文档中提到的,我检查了所需的正确版本
npm info "eslint-config-airbnb@latest" peerDependencies
{
eslint: '^7.32.0 || ^8.2.0',
'eslint-plugin-react': '^7.28.0',
'eslint-plugin-import': '^2.25.3',
'eslint-plugin-jsx-a11y': '^6.5.1',
'eslint-plugin-react-hooks': '^4.3.0'
}
根据我安装的输出[email protected]
,上述错误没有返回。
现在,问题是我无法安装,eslint-config-airbnb-typescript
因为它给出了不同的依赖问题。
我尝试通过安装所需版本@typescript-eslint/parser
和来修复此问题@typescript-eslint/eslint-plugin
,但它似乎给出了一个循环错误。