0

我正在尝试将 VSCode ESLint 扩展与全局安装eslint以及包的全局安装eslint-plugin-reacteslint-plugin-react-native.

但是,在启动时,ESLint 服务器输出报告错误:

[Info  - 1:44:44 PM] ESLint library loaded from: /Users/username/.config/yarn/global/node_modules/eslint/lib/api.js
(node:3042) UnhandledPromiseRejectionWarning: Error: Failed to load plugin 'react' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-react'

据我了解,ESLint 尝试加载相对于.eslintrc.json路径的插件 - 这是当前打开项目的文件夹。
相反,eslint-plugin-reacteslint-plugin-react-native包安装在项目路径之外的全局纱线包目录中。

有没有办法设置扩展以使用全局安装的包?如果可以设置这样的话,那就太好了,如果有本地包可用,则使用它们,如果本地包不可用,则回退到全局包。

ps以上是针对Mac OS环境的,有zsh

4

0 回答 0