ESLint 找不到插件“eslint-plugin-react”

yad*_*ada 5 sublimetext eslint

我在 sublime-text 3 中工作,项目结构如下:

workdir

--root-project-dirictory

---- src

---- eslint.yml

--project.sublime-project
Run Code Online (Sandbox Code Playgroud)

问题是这样的:ESLint正在寻找eslint-plugin-react插件workdir,而不是在root-project-dirictory.

结果我得到一个错误:

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "/.../workdir".)

...

The plugin "eslint-plugin-react" was referenced from the config file in "root-project-dirictory / .eslintrc.yml".
Run Code Online (Sandbox Code Playgroud)

yad*_*ada -1

到目前为止,我还没有找到在不改变工作目录结构的情况下解决这个问题的方法。

作为解决方案,我使用以下方法:

  • 创建一个空的 sublime-text 项目

  • 将一一文件夹添加到项目中,如“src”、“app”...

  • 如果 --root-project-directory 中需要文件,则添加它,但我正在项目的单独 sublime-text 文件夹中处理该应用程序