JSPM

  • Created
  • Published
  • Downloads 14960
  • Score
    100M100P100Q143369F
  • License MIT

TSLint rules for RxJS

Package Exports

  • rxjs-tslint-rules

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rxjs-tslint-rules) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rxjs-tslint-rules

NPM version Build status dependency status devDependency Status peerDependency Status

What is it?

rxjs-tslint-rules is small set of TSLint rules to help manage projects that use rxjs/add/... imports.

Why might I need it?

When using imports that patch Observable:

import { Observable } from "rxjs/Observable";
import from "rxjs/add/observable/of";
import from "rxjs/add/operator/map";

TypeScript will see the merged declarations in all modules, making it difficult to find rxjs/add/... imports that are missing from modules in which patched observables and operators are used.

This can cause problems, as whether or not Observable is patched then depends upon the order in which the modules are executed.

The rules in this package can be used to highlight missing - or unused - imports.

Install

Install the package using NPM:

npm install rxjs-tslint-rules --save

Update your tslint.json file to extend this package:

{
  "extends": [
    "rxjs-tslint-rules"
  ],
  "rules": {
    "rxjs-add": { "severity": "error" },
    "rxjs-no-unused-add": { "severity": "error" }
  }
}

The package includes the following rules:

Rule Description
rxjs-add Enforces the importation of patched observables or operators used in the module.
rxjs-no-add Disallows the importation of patched observables and operators.
rxjs-no-unused-add Disallows the importation of patched observables or operators that are not used in the module.
rxjs-prefer-add Disallows the importation of rxjs or rxjs/Rx.