angular-eslint: ng lint: NOT SUPPORTED: keyword "id", use "$id" for schema ID

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present

Description

After install @angular-eslint/schematics on new project, run ng lint raise exception NOT SUPPORTED: keyword "id", use "$id" for schema ID

🔬 Minimal Reproduction

ng new my-app
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? SCSS   [ https://sass-lang.com/ documentation/syntax#scss]
CREATE my-app/angular.json (3207 bytes)
CREATE my-app/package.json (1070 bytes)
CREATE my-app/README.md (1051 bytes)
CREATE my-app/tsconfig.json (863 bytes)
CREATE my-app/.editorconfig (274 bytes)
CREATE my-app/.gitignore (620 bytes)
CREATE my-app/.browserslistrc (600 bytes)
CREATE my-app/karma.conf.js (1423 bytes)
CREATE my-app/tsconfig.app.json (287 bytes)
CREATE my-app/tsconfig.spec.json (333 bytes)
CREATE my-app/src/favicon.ico (948 bytes)
CREATE my-app/src/index.html (291 bytes)
CREATE my-app/src/main.ts (372 bytes)
CREATE my-app/src/polyfills.ts (2338 bytes)
CREATE my-app/src/styles.scss (80 bytes)
CREATE my-app/src/test.ts (745 bytes)
CREATE my-app/src/assets/.gitkeep (0 bytes)
CREATE my-app/src/environments/environment.prod.ts (51 bytes)
CREATE my-app/src/environments/environment.ts (658 bytes)
CREATE my-app/src/app/app-routing.module.ts (245 bytes)
CREATE my-app/src/app/app.module.ts (393 bytes)
CREATE my-app/src/app/app.component.html (24617 bytes)
CREATE my-app/src/app/app.component.spec.ts (1073 bytes)
CREATE my-app/src/app/app.component.ts (211 bytes)
CREATE my-app/src/app/app.component.scss (0 bytes)
V Packages installed successfully.

cd my-app

ng add @angular-eslint/schematics
i Using package manager: npm
V Found compatible package version: @angular-eslint/schematics@1.2.0.
V Package information loaded.

The package @angular-eslint/schematics@1.2.0 will be installed and executed.
Would you like to proceed? Yes
V Package successfully installed.

An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for sche
ma ID
See "angular-errors.log" for furt her details.

angular-errors.log

[error] Error: NOT SUPPORTED: keyword "id", use "$id" for schema ID
    at Object.code (\my-app\node_modules\ajv\dist\vocabularies\core\id.js:6:15)
    at keywordCode (\my-app\node_modules\ajv\dist\compile\validate\index.js:454:13)
    at \my-app\node_modules\ajv\dist\compile\validate\index.js:222:17
    at CodeGen.code (\my-app\node_modules\ajv\dist\compile\codegen\index.js:439:13)
    at CodeGen.block (\my-app\node_modules\ajv\dist\compile\codegen\index.js:568:18)
    at iterateKeywords (\my-app\node_modules\ajv\dist\compile\validate\index.js:219:9)
    at groupKeywords (\my-app\node_modules\ajv\dist\compile\validate\index.js:208:13)
    at \my-app\node_modules\ajv\dist\compile\validate\index.js:192:13
    at CodeGen.code (\my-app\node_modules\ajv\dist\compile\codegen\index.js:439:13)
    at CodeGen.block (\my-app\node_modules\ajv\dist\compile\codegen\index.js:568:18)

🔥 Exception or Error


Error: NOT SUPPORTED: keyword "id", use "$id" for schema ID

🌍 Your Environment


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / ? \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 13.0.1
Node: 12.22.1
Package Manager: npm 6.14.12
OS: win32 x64

Angular: 13.0.0
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.1
@angular-devkit/build-angular   13.0.1
@angular-devkit/core            13.0.1
@angular-devkit/schematics      13.0.1
@angular/cli                    13.0.1
@schematics/angular             13.0.1
rxjs                            7.4.0
typescript                      4.4.4

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 17 (2 by maintainers)

Most upvoted comments

After v14-lts release, if you are using any specific Angular major version, it is better to install schematics matching the Angular version. For example, I’m using Angular v14-lts, so I’m installing schematics this way:

ng add @angular-eslint/schematics@14

Hi @cesco69, you need to use the v13 prerelease with Angular 13:

ng add @angular-eslint/schematics@next

Please see #715

Just to confirm https://github.com/angular-eslint/angular-eslint/issues/790#issuecomment-962988420 works for anyone currently adding angular-eslint to an Angular v14 project.

Folks there is no issue with angular-eslint here and that’s been the case for a very long time now.

100% of the time this is down to rogue old Angular dependencies on your machine. It’s not something that can be resolved by tooling you will need to troubleshoot your setup.

You can try lots of things to fix your machine:

First run ng version to see what version of the packages it resolves. If any of them do not match the first number you have already found the problem and you will need to make sure the major versions align (NOTE: for some packages that start with a leading zero, it’s the next set of numbers that should align, e.g. @angular-devkit/architect 0.1300.1 @angular-devkit/build-angular 13.0.1 are a good match back from the Angular 13 days).

If still an issue you need to try and remove any outdated cached packages that might somehow exist. Some ideas:

  • Remove your node_modules and delete your lock file and rebuild it with a fresh install
  • Force clean your global npm cache (npm clear cache --force)
  • delete your npx cache (on a mac that is rm -rf ~/.npm/_npx)

Hope that helps, but please stop adding to this resolved issue, there is nothing to “fix” in angular-eslint

I’ve fixed the error by following the steps

Steps

  1. Checked the released page here - https://github.com/angular-eslint/angular-eslint/releases
  2. Checked the current angular version (mine was 14.0.0)
  3. Then I ran ng add command on a specific version
  4. ng add @angular-eslint/schematics@14.0.0

@karimerrebai and @Jorgeflowers18 may be you can also give a shot by above steps.

Would you like to add a package with “deploy” capabilities now? GitHub Pages Skipping installation: Package already installed NOT SUPPORTED: keyword “id”, use “$id” for schema ID

angular 16

this ng add @angular-eslint/schematics@next works, but I hade to remove the folder node_modules

I got the schematics@13 but it still throw the unhandled error NOT SUPPORTED: keyword “id”, use “$id” for schema ID

I do still have the same issue as well. Not sure why it’s closed. An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID Angular 13.3.8 and eslint bundle 13.2.1

I ran the steps to migrate Angular & material from 12 to 13. Then ran ng add @angular-eslint/schematics@13.5.0 Still getting this error.

Update: ESLint wasn’t causing this error apparently. This error was being shown when I ran ng test. The exact error I was getting was:

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

I removed all the installation done by the schematics@13 command. Resolved the error by upgrading the following packages:

Package Version
@angular-builders/jest 11 to 13
jest 26 to 27
jest-config 26 to 27
jest-preset-angular 8 to 11
ts-jest installed 27