@@ -205,14 +205,21 @@ function findImportedRxjsOperators(sourceFile: ts.SourceFile): Set<string> {
205
205
* @param startIndex Position where the {@link Lint.Replacement} can be inserted
206
206
*/
207
207
function createImportReplacements ( operatorsToAdd : Set < string > , startIndex : number ) : Lint . Replacement [ ] {
208
- return [ ...Array . from ( operatorsToAdd . values ( ) ) ] . map ( operator =>
209
- NGRX_OPERATORS . has ( operator )
210
- ? Lint . Replacement . appendText ( startIndex , `\nimport {${ operator } } from '@ngrx/store';\n` )
211
- : Lint . Replacement . appendText (
212
- startIndex ,
213
- `\nimport {${ operator } } from 'rxjs/operators/${ operator } ';\n`
214
- )
215
- ) ;
208
+ return [ ...Array . from ( operatorsToAdd . values ( ) ) ] . map ( operator => {
209
+ let importPath : string ;
210
+ if ( NGRX_EFFECT_OPERATORS . has ( operator ) ) {
211
+ importPath = '@ngrx/effects' ;
212
+ }
213
+ if ( NGRX_STORE_OPERATORS . has ( operator ) ) {
214
+ importPath = '@ngrx/store' ;
215
+ } else {
216
+ importPath = `rxjs/operators/${ operator } ` ;
217
+ }
218
+ return Lint . Replacement . appendText (
219
+ startIndex ,
220
+ `\nimport {${ operator } } from '${ importPath } ';\n`
221
+ ) ;
222
+ } ) ;
216
223
}
217
224
218
225
/**
@@ -302,7 +309,8 @@ function replaceWithPipeableOperators(
302
309
return [ operatorReplacement , ...separatorReplacements , ...moreReplacements ] ;
303
310
}
304
311
305
- const NGRX_OPERATORS = new Set ( [ 'ofType' , 'select' ] ) ;
312
+ const NGRX_STORE_OPERATORS = new Set ( [ 'select' ] ) ;
313
+ const NGRX_EFFECT_OPERATORS = new Set ( [ 'ofType' ] ) ;
306
314
307
315
/**
308
316
* Set of all instance operators, including those renamed as part of lettable
0 commit comments