簡體   English   中英

ESLint 無法識別“@typescript-eslint/eslint-plugin”

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

我一直試圖讓 ESLint 在 VS Code 中處理一個新的 Angular 項目,但它無法加載“@typescript-eslint/eslint-plugin”。 在過去的 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.

到目前為止我已采取的調試步驟:

  • 我卸載了全局版本以及擴展,然后重新安裝了擴展並在項目文件夾中本地安裝了 ESLint。
  • 我正在使用全新安裝的 Angular 應用程序,該應用程序是使用 Angular ng new命令創建的。
  • 我運行了eslint --debug /Users/Yahia/Desktop/Plugngrow-UI/png-ui/.eslintrc.js命令。 除了在調試時忽略“.eslintrc.js”文件的警告之外,它不會導致任何警告。

請注意,ESLint 在我在做介紹性教程時從 Angular 文檔下載的另一個項目中運行良好。

如果這有助於檢查,我已經為該項目創建了一個Github 存儲庫

請原諒我在編程和相關工具方面的新穎性。

我昨天剛遇到這個問題。 我建議您在本地重新安裝“@typescript-eslint/eslint-plugin”並查看幫助。 您還可以重新設置 eslintrc.js 文件,應該很容易修復。

這個鏈接很有幫助。 https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM