简体   繁体   English

ESLint 无法识别“@typescript-eslint/eslint-plugin”

[英]ESLint is not recognizing "@typescript-eslint/eslint-plugin"

I have been trying to get ESLint to work on a new Angular project in VS Code but it is failing to load "@typescript-eslint/eslint-plugin".我一直试图让 ESLint 在 VS Code 中处理一个新的 Angular 项目,但它无法加载“@typescript-eslint/eslint-plugin”。 I have spent the last 3 hours trying to figure out where the problem is and looked everywhere for a solution.在过去的 3 个小时里,我一直试图找出问题所在,并到处寻找解决方案。

Failed to load plugin '@typescript-eslint' declared in 'png-ui/.eslintrc.js': Cannot find module '@typescript-eslint/eslint-plugin'
Require stack:
- /Users/Yahia/Desktop/Plugngrow-UI/__placeholder__.js
Referenced from: /Users/Yahia/Desktop/Plugngrow-UI/png-ui/.eslintrc.js
Happened while validating /Users/Yahia/Desktop/Plugngrow-UI/png-ui/.eslintrc.js
This can happen for a couple of reasons:
1. The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc).
2. If ESLint is installed globally, then make sure '@typescript-eslint/eslint-plugin' is installed globally as well.
3. If ESLint is installed locally, then '@typescript-eslint/eslint-plugin' isn't installed correctly.

Consider running eslint --debug /Users/Yahia/Desktop/Plugngrow-UI/png-ui/.eslintrc.js from a terminal to obtain a trace about the configuration files used.

Debugging steps that I have taken so far:到目前为止我已采取的调试步骤:

  • I uninstalled the global version as well as the extension, then reinstalled the extension and installed ESLint locally in the project folder.我卸载了全局版本以及扩展,然后重新安装了扩展并在项目文件夹中本地安装了 ESLint。
  • I am using a fresh install of an Angular app that was created using Angular ng new command.我正在使用全新安装的 Angular 应用程序,该应用程序是使用 Angular ng new命令创建的。
  • I ran eslint --debug /Users/Yahia/Desktop/Plugngrow-UI/png-ui/.eslintrc.js command.我运行了eslint --debug /Users/Yahia/Desktop/Plugngrow-UI/png-ui/.eslintrc.js命令。 It results in no warnings other than a warning for ignoring the ".eslintrc.js" file while debugging.除了在调试时忽略“.eslintrc.js”文件的警告之外,它不会导致任何警告。

Please note that ESLint works fine in another project which I downloaded from Angular docs while doing the introductory tutorial.请注意,ESLint 在我在做介绍性教程时从 Angular 文档下载的另一个项目中运行良好。

I have created a Github repo for the project if that helps with checking.如果这有助于检查,我已经为该项目创建了一个Github 存储库

Please, excuse my novelty in programming and related tools.请原谅我在编程和相关工具方面的新颖性。

I just met with this problem yesterday.我昨天刚遇到这个问题。 I would suggest you reinstall "@typescript-eslint/eslint-plugin" locally and see that help.我建议您在本地重新安装“@typescript-eslint/eslint-plugin”并查看帮助。 You can also have fresh setup of eslintrc.js file and should be easy to fix.您还可以重新设置 eslintrc.js 文件,应该很容易修复。

This link was helpful.这个链接很有帮助。 https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 @typescript-eslint/eslint-plugin 错误:定义了“路由”但从未使用过(no-unused-vars) - @typescript-eslint/eslint-plugin error: 'Route' is defined but never used (no-unused-vars) ESLint:8.0.0 无法加载插件'@typescript-eslint' - ESLint: 8.0.0 Failed to load plugin '@typescript-eslint' eslint 缩进和@typescript-eslint/indent 冲突 - eslint indent and @typescript-eslint/indent conflict @typescript-eslint/no-unsafe-* 规则的新 eslint 错误 - New eslint errors with the @typescript-eslint/no-unsafe-* rules angular-eslint 和 typescript-eslint 之间的区别 - Difference between angular-eslint and typescript-eslint ESLint 找不到插件“eslint-plugin-@typescript-eslint” - ESLint couldn't find the plugin "eslint-plugin-@typescript-eslint" TypeScript 和 typescript-eslint 有重叠的用途吗? - Do TypeScript and typescript-eslint have overlapping purposes? Typescript:ESLint:任何类型值的不安全返回 @typescript-eslint/no-unsafe-return - Typescript : ESLint : Unsafe return of an any typed value @typescript-eslint/no-unsafe-return @typescript-eslint/no-unsafe-assignment:任何值的不安全赋值 - @typescript-eslint/no-unsafe-assignment: Unsafe assignment of an any value @typescript-eslint/parser parserOptions.ecmaVersion 忽略/不检查 - @typescript-eslint/parser parserOptions.ecmaVersion ignored / not linting
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM