[英]How to use eslint plugin modules located in parent directory?
I have some services organized into a monorepo in such a fashion: 我有一些服务以这样的方式组织成monorepo:
repo_root/ ├── services/ │ ├── service_one/ │ ├── service_two/ │ └── service_three/ ├── package.json ├── node_modules ├── .eslintrc
Additionally, each individual service has its own package.json
and node_modules
. 此外,每个服务都有自己的
package.json
和node_modules
。 I would like to use the eslint configuration stored in the repo_root
directory to lint individual services. 我想使用存储在
repo_root
目录中的eslint配置来lint各个服务。 My problem is that when I try to run something like 我的问题是当我尝试运行类似的东西时
eslint services/service_one
for example, it fails to find the eslint plugin modules that are required by .eslintrc
and installed in the node_modules
directory of repo_root
. 例如,它未能找到由所需的eslint插件模块
.eslintrc
并安装在node_modules
的目录repo_root
。
I'd like to avoid redundantly requiring these plugin modules in every service. 我想避免在每个服务中冗余地要求这些插件模块。 Is there anyway to configure eslint to intelligently find the modules even though they are in the parent directory of the services themselves?
是否有配置eslint智能查找模块,即使它们在服务的父目录中?
For anyone wondering, my problem was I was running the command using a globally installed eslint, which in turn looked for global modules. 对于任何想知道的人,我的问题是我使用全局安装的eslint运行命令,而eslint又查找全局模块。 After changing it to run a local version of eslint, everything worked fine!
更改它以运行本地版本的eslint后,一切正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.