【问题标题】:ESLint complaining about ESLint plugins not being installed in a monorepoESLint 抱怨 ESLint 插件没有安装在 monorepo 中
【发布时间】:2019-05-03 06:06:42
【问题描述】:

在 monorepo 设置中,我收到了一些错误,因为没有安装一些 ESLint 插件,而我的 plugins 数组中没有列出这些插件。

我的项目在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.

【问题讨论】:

    标签: eslint


    【解决方案1】:

    出现此问题是因为某些软件包随它们一起提供了 .eslintrc 文件,并且 ESLint 在运行它时会获取这些配置。默认情况下,ESLint 会忽略 node_modules 中的所有配置,但如果您有 .eslintignore,您应该添加一行来忽略深层 node_modules 文件夹,这样那些杂散的配置就不会被拾取。

    .eslintignore

    packages/**/node_modules
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-16
      • 2016-07-02
      • 2021-11-07
      • 2023-03-18
      • 1970-01-01
      • 2022-10-24
      • 2018-06-29
      相关资源
      最近更新 更多