0.0.2 • Published 5 years ago

ngrx-tslint-oftype v0.0.2

Weekly downloads
91
License
MIT
Repository
github
Last release
5 years ago

NgRx TSLint

TSLint rules for NgRx. Heavily based on ReactiveX/rxjs-tslint

Table of Contents

Rules

ngrx-effects-operators

Migrates the ofType function to its pipeable equivalent.

BEFORE:
import { Effect, Actions } from '@ngrx/effects';

@Effect()
search = this.actions.ofType<SearchAnimals>(SEARCH_ANIMALS).pipe(
    debounceTime(3000),
    switchMap(...),
  );

AFTER:
import { Effect, Actions, ofType } from '@ngrx/effects';

@Effect()
search = this.actions.pipe(
    ofType<SearchAnimals>(SEARCH_ANIMALS),
    debounceTime(3000),
    switchMap(...),
  );

ngrx-chained-pipes

Because the rules above will create a new pipe chain you may end up with multiple pipes, this rule will combine both pipe chains.

BEFORE:
this.store.pipe(select(...)).pipe(map(...))

AFTER:
this.store.pipe(select(...), map(...))

Usage

{
  "rulesDirectory": ["node_modules/ngrx-tslint-oftype"],
  "rules": {
    "ngrx-effects-operators": true,
    "ngrx-chained-pipes": true
  }
}

License

MIT