Member-only story
RxJS: TSLint Rules for Version 6
Earlier this week, RxJS version 6 was released and, with its release, managing RxJS imports has become much, much easier.
Last year, I wrote a bunch of TSLint rules for managing RxJS imports. They’re distributed in the rxjs-tslint-rules
package.
Most of the package’s import-related rules are no longer required when linting an RxJS-version-6 codebase, so if the latest release of the rules finds RxJS version 6 installed in node_modules
, the rules that are no longer required are deprecated.
If RxJS version 5 is installed — or if rxjs-compat
is installed alongside RxJS version 6 — the rules will behave as they did in prior releases of the package.
Let’s look briefly at what’s changed and then look at some rules that are still useful for maintaining a clean, RxJS-version-6 codebase.
What’s changed with the imports?
The migration guide discusses all of the changes in detail, but the main, import-related changes can be summarised as follows:
- Classes, types and observable factory functions are imported from
"rxjs"
. - Operators are imported from
"rxjs/operators"
. - Factory functions and operators that patch
Observable
andObservable.prototype
have been removed.