簡體   English   中英

Angular 12 從 tslint 切換到 eslint 后模板 linting 不起作用

[英]Angular 12 template linting not working after switchting from tslint to eslint

將 nx 工作區升級到 v12 后,一切正常,預期模板在 IDE 中被 linted。

IDE (WebStorm) 顯示了一些以前從未發生過的奇怪錯誤: 升級 Angular 后出現 linting 錯誤

第一個警告說No directive is match on attribute ngIf即使導入了CommonModule ,與async相關的第二個錯誤說Missing require() statement and var async = require('@angular/core/testing').async;

這真的很有趣,因為構建整個 monorepo 完美無缺,所以我猜這可能是由一些不正確的 linting 配置引起的。 不得不說,workspace 不僅更新到了最新的nx版本,還從tslint轉換成了eslint

過去有人遇到過類似的問題嗎?

I had the same No directive is matched on attribute ngIf message in PhpStorm, after updating a project to Angular 12. I created a new project with Angular CLI and had the same issue, while another project still on Angular 9 worked fine in the same IDE同時。

我確實幫助 > 檢查更新,它說一切都是最新的,但在查看 JetBrains 網站時,我注意到有一個更新版本的 Angular 插件,它與更新版本的 PhpStorm 捆綁在一起,即自動更新在 IDE 中沒有找到; 我安裝了新的 PhpStorm,問題得到解決。

目前使用 PhpStorm 2021.1.4

在 PyCharm 上有同樣的問題。 2021.3 RC 的更新解決了這個問題。 它也應該適用於 WebStorm。

我在 VS Code 上也有同樣的情況。 原因是在“Angular Language Service”插件中,需要重新啟動它並且錯誤消失了。 因此,如上所述,只需通過 IDE 上的擴展名 go 並“重新啟動/更新或禁用”它並檢查錯誤是否消失。

暫無
暫無

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

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