简体   繁体   中英

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:

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. But then, after executing ng g @angular-eslint/schematics:convert-tslint-to-eslint your_project_name I got the following error: 在此处输入图像描述

I looked at this post already: How to run @angular-eslint/schematics:convert-tslint-to-eslint , but nothing about it helped.

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. What might cause this?

My TsLint version: 6.1.0

My Angular version: 12.0.2

Note that I upgraded to Angular 12 a week ago, before it was Angular 11.

I tried the same upgrade in my project and added

  "cli": {
    "analytics": false,
    "defaultCollection": "@angular-eslint/schematics"
  },

in my angular.json manually. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM