简体   繁体   English

Angular 12 从 tslint 切换到 eslint 后模板 linting 不起作用

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

After upgrading an nx workspace to v12, everything works as before, expected template linted in the IDE.将 nx 工作区升级到 v12 后,一切正常,预期模板在 IDE 中被 linted。

The IDE (WebStorm) shows some strange errors never happend before: IDE (WebStorm) 显示了一些以前从未发生过的奇怪错误: 升级 Angular 后出现 linting 错误

The first warning says No directive is matched on attribute ngIf even the CommonModule is imported, the second error related to the async says Missing require() statement and var async = require('@angular/core/testing').async;第一个警告说No directive is match on attribute ngIf即使导入了CommonModule ,与async相关的第二个错误说Missing require() statement and var async = require('@angular/core/testing').async;

It's really interesting, because building the whole monorepo works flawlessly so I guess this could be caused by some incorrect linting configuration.这真的很有趣,因为构建整个 monorepo 完美无缺,所以我猜这可能是由一些不正确的 linting 配置引起的。 Have to say that the workspace was not just updated to the newest nx version, It was converted from tslint to eslint as well.不得不说,workspace 不仅更新到了最新的nx版本,还从tslint转换成了eslint

Did someone had similar issues in the past?过去有人遇到过类似的问题吗?

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 at the same time. 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同时。

I did help > check for updates, and it said everything was up to date, but while looking on the JetBrains website I noticed there was a newer version of the Angular Plugin, that was bundled with a newer version of PhpStorm, that the auto update in the IDE had not found;我确实帮助 > 检查更新,它说一切都是最新的,但在查看 JetBrains 网站时,我注意到有一个更新版本的 Angular 插件,它与更新版本的 PhpStorm 捆绑在一起,即自动更新在 IDE 中没有找到; I installed the new PhpStorm and the problem was fixed.我安装了新的 PhpStorm,问题得到解决。

Currently using PhpStorm 2021.1.4目前使用 PhpStorm 2021.1.4

Had the same issue on PyCharm.在 PyCharm 上有同样的问题。 An update to 2021.3 RC solved the problem. 2021.3 RC 的更新解决了这个问题。 It should also work on WebStorm.它也应该适用于 WebStorm。

I have the same on VS Code.我在 VS Code 上也有同样的情况。 The cause was in "Angular Language Service " plugin, was need to restart it and the error disappear.原因是在“Angular Language Service”插件中,需要重新启动它并且错误消失了。 So as mention above just go through extensions on your IDE and "restart/update or disable" it and check if error disappear.因此,如上所述,只需通过 IDE 上的扩展名 go 并“重新启动/更新或禁用”它并检查错误是否消失。

暂无
暂无

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

相关问题 Linting 不适用于 tslint Angular 9 中的 Typescript 3.7 - Linting not working for Typescript 3.7 in tslint Angular 9 发生未处理的异常:无效的 lint 配置。 在 Angular 12 中将 Tslint 迁移到 eslint 后没有任何 lint - An unhandled exception occurred: invalid lint configuration. Nothing to lint after migrating Tslint to eslint in Angular 12 从 TSLint 迁移到 ESLint 和 ESLint 导致解析错误:Unexpected token &lt; and does not check.ts files in angular v12 - Migrated from TSLint to ESLint and ESLint causes parsing error: Unexpected token < and does not check .ts files in angular v12 Nx Angular TSLint 到 ESLint 迁移后的 Lint 错误 - Nx Angular Lint Error after TSLint to ESLint Migration 将 angular 更新到 v14 后,TSlint 规则变为 ESlint - TSlint rules to ESlint after update angular to v14 如何防止规则 `@angular-eslint/template/i18n` 掉落 `mat-icon` 元素 - How to prevent rule `@angular-eslint/template/i18n` from linting `mat-icon` elements “TSLint 仍然存在”=&gt; 从 TSlint 升级到 ESLint - “TSLint still there” => upgrading from TSlint to ESLint Tslint 到 Eslint 迁移 - convert-tslint-to-eslint 命令后出错 - Tslint to Eslint migration - Error after convert-tslint-to-eslint command 如何运行@angular-eslint/schematics:convert-tslint-to-eslint - How to run @angular-eslint/schematics:convert-tslint-to-eslint Tslint 在使用 Angular 的 Emacs 中不起作用 - Tslint not working in Emacs using Angular
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM