小编Ole*_*leg的帖子

Eslint 在 VScode 中不起作用,但在终端中起作用

我有 rush 管理的 monorepository ( https://rushjs.io/ )

代码结构为:

在此处输入图片说明

如您所见,有两个 eslint 配置和两个目录node_modules(它只是由 rush 创建的符号链接)。

Eslint 支持完美工作。

但是我在前面的 eslint 配置方面遇到了一些麻烦。当我使用yarn eslint --ext .js --ext .jsx ./srcfrom directory运行它时 front,它可以工作。

但它不起作用,当 eslint 从 vscode 启动时。在输出中我看到:

Consider running eslint --debug /Users/oleg/Desktop/projects/hire/front/src/pages/config.js from a terminal to obtain a trace about the configuration files used.
[Error - 2:04:08 PM] 
Failed to load plugin 'react' declared in 'front/.eslintrc': Cannot find module 'eslint-plugin-react'
Require stack:
- /Users/oleg/Desktop/projects/hire/__placeholder__.js
Referenced from: /Users/oleg/Desktop/projects/hire/front/.eslintrc
Happened while validating /Users/oleg/Desktop/projects/hire/front/src/pages/config.js …
Run Code Online (Sandbox Code Playgroud)

javascript eslint visual-studio-code monorepo

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

eslint ×1

javascript ×1

monorepo ×1

visual-studio-code ×1