rxjs-tslint icon indicating copy to clipboard operation
rxjs-tslint copied to clipboard

Add support for ngrx store 6 -> 7 migration

Open zbarbuto opened this issue 6 years ago • 1 comments

Hopefully this isn't too out of scope for what this tool was designed for.

I've had a few projects I've had to migrate which make extensive use of NgRX for state management. Because the ofType and select operators aren't RxJS operators none of my @Effects or store selectors fully migrated to RxJS 6 style piped operators.

This simple change means that this tool becomes an rxjs-5-to-6 as well as ngrx-6-to-7 migration tool.

Migrates:

this.store.select(selector)

// to
import { select } from '@ngrx/store';

this.store.pipe( select(selector) );

and

this.actions$.ofType([SomeType])

// to
import { ofType } from '@ngrx/store';

this.actions$.pipe( ofType([SomeType]) )

zbarbuto avatar Apr 26 '19 08:04 zbarbuto

Worth noting also that this will only work if you have not yet updated your @ngrx/* packages to the lates version.

If you do that first, the .ofType method won't exist and it won't be able to resolve actions$ to an Observable type (I found this out the hard way)

zbarbuto avatar Apr 26 '19 08:04 zbarbuto