在monorepo设置中,当我的plugins
数组中没有列出那些ESLint插件时,我收到一些未安装的错误消息。
我的项目在packages/**
yarn lint
yarn run v1.15.2
$ eslint --config .eslintrc ./
Oops! Something went wrong! :(
ESLint: 5.16.0.
ESLint couldn't find the plugin "eslint-plugin-airbnb". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-airbnb is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.
2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
npm i eslint-plugin-airbnb@latest --save-dev
Path to ESLint package: /mnt/airlab/repos/one/node_modules/eslint
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
答案 0 :(得分:1)
之所以会发生此问题,是因为某些程序包附带了它们的.eslintrc
文件,并且ESLint在运行它们时会拾取这些配置。默认情况下,ESLint会忽略node_modules
中的所有配置,但是如果您有.eslintignore
,则应添加一行以忽略深层的node_modules文件夹,这样就不会拾取那些杂散的配置。
.eslintignore
packages/**/node_modules