[英]Upgrading to EsLint: Error with angular.json (schematics:convert-tslint-to-eslint)
I wanted to upgrade my project to ESLint and was following this tutorial:我想将我的项目升级到 ESLint 并遵循本教程:
https://blog.ninja-squad.com/2021/03/31/migrating-from-tslint-to-eslint/ https://blog.ninja-squad.com/2021/03/31/migrating-from-tslint-to-eslint/
I did the first command, ng add @angular-eslint/schematics
, which worked.我做了第一个命令,
ng add @angular-eslint/schematics
,它起作用了。 But then, after executing ng g @angular-eslint/schematics:convert-tslint-to-eslint your_project_name
I got the following error:但是,在执行
ng g @angular-eslint/schematics:convert-tslint-to-eslint your_project_name
之后,出现以下错误:
I looked at this post already: How to run @angular-eslint/schematics:convert-tslint-to-eslint , but nothing about it helped.我已经看过这篇文章: 如何运行 @angular-eslint/schematics:convert-tslint-to-eslint ,但没有任何帮助。
This seems like an easy error to google but either I searched incorrectly or this really is some unusual problem.这对谷歌来说似乎是一个简单的错误,但要么我搜索不正确,要么这确实是一些不寻常的问题。 Obviously, I cannot delete the angular.json file.
显然,我无法删除 angular.json 文件。 What might cause this?
什么可能导致这种情况?
My TsLint version: 6.1.0我的 TsLint 版本:6.1.0
My Angular version: 12.0.2我的 Angular 版本:12.0.2
Note that I upgraded to Angular 12 a week ago, before it was Angular 11.请注意,我在一周前升级到 Angular 12,之前是 Angular 11。
I tried the same upgrade in my project and added我在我的项目中尝试了相同的升级并添加了
"cli": {
"analytics": false,
"defaultCollection": "@angular-eslint/schematics"
},
in my angular.json manually.手动在我的 angular.json 中。 After this I could continue with no errors.
在此之后,我可以继续没有错误。
You should run this command from your root of your project (without the name of the project like you did)您应该从项目的根目录运行此命令(没有您所做的项目名称)
ng g @angular-eslint/schematics:convert-tslint-to-eslint
I suggest to consider using this walkthrough instead https://www.bitovi.com/blog/angular-upgrades-painless-migration-from-tslint-to-eslint since it seems clearer from my point of view.我建议考虑使用此演练代替https://www.bitovi.com/blog/angular-upgrades-painless-migration-from-tslint-to-eslint ,因为从我的角度来看,它似乎更清晰。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.