@@ -170,6 +170,80 @@ describe('Store ng-add Schematic', () => {
170
170
} ) ;
171
171
} ) ;
172
172
173
+ it ( 'should register the NgRx ESLint Plugin in overrides when it supports TS' , async ( ) => {
174
+ const options = { ...defaultOptions } ;
175
+
176
+ // this is a trimmed down version of the default angular-eslint schematic
177
+ const initialConfig = {
178
+ overrides : [
179
+ {
180
+ files : [ '*.ts' ] ,
181
+ parserOptions : {
182
+ project : [ 'tsconfig.eslint.json' ] ,
183
+ createDefaultProgram : true ,
184
+ } ,
185
+ extends : [
186
+ 'plugin:@angular-eslint/recommended' ,
187
+ 'eslint:recommended' ,
188
+ 'plugin:@typescript-eslint/recommended' ,
189
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking' ,
190
+ 'plugin:@angular-eslint/template/process-inline-templates' ,
191
+ 'plugin:prettier/recommended' ,
192
+ ] ,
193
+ } ,
194
+ {
195
+ files : [ '*.html' ] ,
196
+ extends : [
197
+ 'plugin:@angular-eslint/template/recommended' ,
198
+ 'plugin:prettier/recommended' ,
199
+ ] ,
200
+ rules : { } ,
201
+ } ,
202
+ ] ,
203
+ } ;
204
+ appTree . create ( '.eslintrc.json' , JSON . stringify ( initialConfig , null , 2 ) ) ;
205
+
206
+ const tree = await schematicRunner
207
+ . runSchematicAsync ( 'ng-add' , options , appTree )
208
+ . toPromise ( ) ;
209
+
210
+ const packageContent = tree . readContent ( 'package.json' ) ;
211
+ const packageJson = JSON . parse ( packageContent ) ;
212
+ expect ( packageJson . devDependencies [ 'eslint-plugin-ngrx' ] ) . toBeDefined ( ) ;
213
+
214
+ const eslintContent = tree . readContent ( `.eslintrc.json` ) ;
215
+ const eslintJson = JSON . parse ( eslintContent ) ;
216
+ expect ( eslintJson ) . toEqual ( {
217
+ overrides : [
218
+ {
219
+ files : [ '*.ts' ] ,
220
+ parserOptions : {
221
+ project : [ 'tsconfig.eslint.json' ] ,
222
+ createDefaultProgram : true ,
223
+ } ,
224
+ plugins : [ 'ngrx' ] ,
225
+ extends : [
226
+ 'plugin:@angular-eslint/recommended' ,
227
+ 'eslint:recommended' ,
228
+ 'plugin:@typescript-eslint/recommended' ,
229
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking' ,
230
+ 'plugin:@angular-eslint/template/process-inline-templates' ,
231
+ 'plugin:prettier/recommended' ,
232
+ 'plugin:ngrx/recommended' ,
233
+ ] ,
234
+ } ,
235
+ {
236
+ files : [ '*.html' ] ,
237
+ extends : [
238
+ 'plugin:@angular-eslint/template/recommended' ,
239
+ 'plugin:prettier/recommended' ,
240
+ ] ,
241
+ rules : { } ,
242
+ } ,
243
+ ] ,
244
+ } ) ;
245
+ } ) ;
246
+
173
247
it ( 'should not register the NgRx ESLint Plugin when skipped' , async ( ) => {
174
248
const options = { ...defaultOptions , skipESLintPlugin : true } ;
175
249
0 commit comments