EsLint 返回与 minimatch 模块相关的错误

问题描述 投票:0回答:1

大家好,我收到一个与 EsLint 配置相关的错误,他返回的错误让我感到困惑。我使用Vite是为了让开发更快捷、更轻松。

下面我将附上 eslint 和 tsconfig/tsconfig.node json 文件和 package.json 的链接。

eslint 配置: https://paste.aiogram.dev/enuganiger.typescript

package.json: https://paste.aiogram.dev/vanohofuyu.json

tsconfig.json: https://paste.aiogram.dev/zurawahimi.json

tsconfig.node.json: https://paste.aiogram.dev/cewikegoso.json

因此,我转到 package.json 所在的文件夹并使用下一个命令安装所有依赖项:

npm i

在我访问任何 js/ts 文件并且没有发生任何事情之后,我的规则没有被应用。 我检查了 EsLint 输出,并收到下一个错误:

[Error - 6:37:22 PM] Failed to load plugin '@typescript-eslint' declared in 'front\.eslintrc.cjs': Cannot find module 'E:\GITHUB PROJECTS\my_projectname\my_projectname\front\node_modules\minimatch\minimatch.js'. 
Please verify that the package.json has a valid "main" entry
Referenced from: E:\GITHUB PROJECTS\my_projectname\my_projectname\front\.eslintrc.cjs
Happened while validating E:\GITHUB PROJECTS\my_projectname\my_projectname\front\.eslintrc.cjs

他返回错误,表明 EsLint 找不到“minimatch.js”模块,但是如果你查看下图,你可以看到 minimatch 模块中没有这个文件。

minimatch structure

package.json(minimatch 模块):

"main": "./dist/cjs/index.js",

我试图删除 node_modules 和 package-lock.json 文件,但没有帮助。安装模块后我也会尝试更新它们。我试图安装不同版本的依赖项。

reactjs typescript eslint tsconfig eslintrc
1个回答
0
投票

我已经修好了!我只是在 settings.json(Vs Code) 中更改了一些与 eslint 相关的数据,之后一切都运行良好!

© www.soinside.com 2019 - 2024. All rights reserved.