eslint 安装警告。需要澄清

eslint installation warnings. Need Clarification

在跟随教程的过程中,我运行使用以下命令安装eslint airbnb和一些依赖项

$ sudo npm install -g eslint-config-airbnb eslint-plugin-import eslint-plugin-react eslint-plugin-jsx-a11y

完成后我收到了一些警告

npm WARN eslint-plugin-react@7.6.0 requires a peer of eslint@^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-import@2.8.0 requires a peer of eslint@2.x - 4.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-configeslint-config-airbnb-airbnb@16.1.0 requires a peer of eslint@^4.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb-base@12.1.0 requires a peer of eslint@^4.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-jsx-a11y@6.0.3 requires a peer of eslint@^3 || ^4 but none is installed. You must install peer dependencies yourself.

好的,所以....我开始觉得教程已经过时了,有些东西已经改变了。我错过了什么(如果有的话)?

请指教

每个节点包都有依赖项,它可以完美运行或已经过测试,因此您会收到警告,因为它们是在包配置中推荐或声明的。因此警告。建议遵循所需的包以避免错误,但大多数情况下,除非您收到错误,否则您应该好好去,因为暗示会在任何存在的版本中打包自己。

在你的情况下,确认你有 eslint package.json,如果没有 运行:

npm install eslint --save-dev

所有的警告都是关于peer dependencies的。它们被归类为 WARN 而不是 ERROR,因为如果您的应用程序代码从不触及此类依赖项,那么您会很好。经过全面测试的代码可以确保可以安全地忽略这些警告。

Excellent explanation to peer dependency