简体   繁体   中英

NOT SUPPORTED: keyword "id", use "$id" for schema ID : TSLint (ng add @angular-eslint/schematics)

I am upgrading my Angular 10 application to Angular 13. I did well with other compatibilities of dependencies. The project is compiling and working fine. Now the time for TSLint I tried to update the lint with the below command.

ng add @angular-eslint/schematics

But getting the error message:

An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID

For eslint:

ng add @angular-eslint/schematics@12 for angular 12

ng add @angular-eslint/schematics@13 for angular 13

ng add @angular-eslint/schematics@14 for angular 14

ng add @angular-eslint/schematics@next

这对我有用 github.com/angular-eslint/angular-eslint/issues/790

It appear while I'm using angular 14, after upgrading angular 15(before that reinstalling angular cli) resolve problem for me.

I solved the problem downgrading angular cli version to 12

在此处输入图片说明

I had the same problem. I could fix it by by upgrading angular/universal to the same version as my angular version is.

It seams that a lot of packages throw this error. I had the same error when adding NgRx store. It looks like that installing the latest version of the packages usually fix the issue:

ng add package_name/@latest

尝试 // - ng add @angular-eslint/schematics@next -//

I had a conflict where the third-party package I was using had been replaced by an official one, but for some reason I had both of them in my package.json file The real issue though was that the angular.json file was using the older builder instead of the newer one. I removed the package and used ng add to add the new package via its schematic, and after that things started working properly.

I faced the same issue in Angular 14, IONIC 6 project while generating pages/components. And resolved it by replacing id with $id manually on following paths:

  1. node_modules > @Ionic > angular-toolkit > schematics > page > schema.json > replace id with $id on line 3.

  2. node_modules > @Ionic > angular-toolkit > schematics > component > schema.json > replace id with $id on line 3.

Install manually the version of @angular/pwa corresponding to your version of angular and then run "ng add @angular/pwa"

For me, just by adding the most current version, did it:

ng add @angular/pwa@15.0.4

The list of versions are here available .

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