Search code examples
angulareslintngrx

Getting error while trying to add ngrx store after ESLint


I have an angular 13 application with ESLint already in place.

I have added ngrx store and dev tools using

ng add @ngrx/store
ng add @ngrx/store-devtools

commands. now when I try to add store

ng g store shared/Shared --module shared.module.ts      

I get an error

An unhandled exception occurred: Schematic "store" not found in collection "@angular-eslint/schematics".

.eslintrc file has changes

},
{
  "files": [
    "*.ts"
  ],
  "extends": [
    "plugin:ngrx/recommended"
  ]
}

and angular.json has this entry

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

how can I retain ESLint and make ngrx work with it ?


Solution

  • The default collection should be the one from NgRx, or you should execute the schematic by explicitly adding the schematic.

      "cli": {
    "defaultCollection": "@ngrx/schematics"
    }
    

    or

    ng generate @ngrx/schematics:store shared/Shared --module shared.module.ts