-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
989 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
# ban-observables | ||
# Avoid banned observable creators (`ban-observables`) | ||
|
||
TK | ||
This rule can be configured so that developers can ban any observable creators they want to avoid in their project. | ||
|
||
## Options | ||
|
||
This rule accepts a single option which is an object the keys of which are the names of observable factory functions and the values are either booleans or strings containing the explanation for the ban. | ||
|
||
The following configuration bans `partition` and `onErrorResumeNext`: | ||
|
||
```json | ||
{ | ||
"rxjs/ban-observables": [ | ||
"error", | ||
{ | ||
"partition": true, | ||
"of": false, | ||
"onErrorResumeNext": "What is this? Visual Basic?" | ||
} | ||
] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
# ban-operators | ||
# Avoid banned operators (`ban-operators`) | ||
|
||
TK | ||
This rule can be configured so that developers can ban any operators they want to avoid in their project. | ||
|
||
## Options | ||
|
||
This rule accepts a single option which is an object the keys of which are the names of operators and the values are either booleans or strings containing the explanation for the ban. | ||
|
||
The following configuration bans `ajax` and `onErrorResumeNext`: | ||
|
||
```json | ||
{ | ||
"rxjs/ban-operators": [ | ||
"error", | ||
{ | ||
"partition": true, | ||
"map": false, | ||
"onErrorResumeNext": "What is this? Visual Basic?" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,50 @@ | ||
# finnish | ||
# Use Finnish notation (`finnish`) | ||
|
||
TK | ||
This rule enforces the use of Finnish notation - i.e. the `$` suffix. | ||
|
||
## Rule details | ||
|
||
Examples of **incorrect** code for this rule: | ||
|
||
```ts | ||
const answers = of(42, 54); | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```ts | ||
const answer$ = of(42, 54); | ||
``` | ||
|
||
## Options | ||
|
||
This rule accepts a single option which is an object with properties that determine whether Finnish notation is enforced for `functions`, `methods`, `parameters`, `properties` and `variables`. It also contains `names` and `types` properties that determine whether of not Finnish notation is to be enforced for specific names or types. | ||
|
||
The default (Angular-friendly) configuration looks like this: | ||
|
||
```json | ||
{ | ||
"rxjs/finnish": [ | ||
"error", | ||
{ | ||
"functions": true, | ||
"methods": true, | ||
"names": { | ||
"^(canActivate|canActivateChild|canDeactivate|canLoad|intercept|resolve|validate)$": false | ||
}, | ||
"parameters": true, | ||
"properties": true, | ||
"types": { | ||
"^EventEmitter$": false | ||
}, | ||
"variables": true | ||
} | ||
] | ||
} | ||
``` | ||
|
||
The properties in the options object are themselves optional; they do not all have to be specified. | ||
|
||
## Further reading | ||
|
||
- [Observables and Finnish Notation](https://medium.com/@benlesh/observables-and-finnish-notation-df8356ed1c9b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
# just | ||
# Use `just` instead of `of` (`just`) | ||
|
||
TK | ||
This rule enforces the use of `just` instead of `of`. Some other languages with Rx implementations use the former and this rule is for developers who have that preference. | ||
|
||
## Options | ||
|
||
This rule has no options. | ||
|
||
## Further reading | ||
|
||
- [Rename `of` to `just`](https://github.com/ReactiveX/rxjs/issues/3747) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# macro | ||
# Use the RxJS Tools macro (`macro`) | ||
|
||
TK | ||
This rule ensures that modules that import `rxjs` also import the Babel macro for [RxJS Tools](https://rxjs.tools). | ||
|
||
## Options | ||
|
||
This rule has no options. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
# no-async-subscribe | ||
# Avoid passing async functions to `subscribe` (`no-async-subscribe`) | ||
|
||
TK | ||
This rule effects failures if async functions are passed to `subscribe`. | ||
|
||
## Rule details | ||
|
||
Examples of **incorrect** code for this rule: | ||
|
||
```ts | ||
import { of } from "rxjs"; | ||
of(42).subscribe(async () => {console.log(value)); | ||
``` | ||
Examples of **correct** code for this rule: | ||
```ts | ||
import { of } from "rxjs"; | ||
of(42).subscribe(() => console.log(value)); | ||
``` | ||
## Options | ||
This rule has no options. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
# no-compat | ||
# Avoid the `rxjs-compat` package (`no-compat`) | ||
|
||
TK | ||
This rule prevents the use of `rxjs-compat`. | ||
|
||
## Options | ||
|
||
This rule has no options. | ||
|
||
## Further reading | ||
|
||
- [Backwards compatibility](https://github.com/ReactiveX/rxjs/blob/a6590e971969c736a15b77154dabbc22275aa0d5/docs_app/content/guide/v6/migration.md#backwards-compatibility) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# no-connectable | ||
# Avoid connectable observables (`no-connectable`) | ||
|
||
TK | ||
This rule prevents the use of connectable observables. | ||
|
||
## Options | ||
|
||
This rule has no options. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# no-create | ||
# Avoid the static `create` function (`no-create`) | ||
|
||
TK | ||
This rule prevents the use of the static `create` function in `Observable`. Developers should use `new` and the constructor instead. | ||
|
||
## Options | ||
|
||
This rule has no options. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
# no-explicit-generics | ||
# Avoid unnecessary explicit type arguments (`no-explicit-generics`) | ||
|
||
TK | ||
This rule prevents the use of explicit type arguments when the type arguments can be inferred. | ||
|
||
## Rule details | ||
|
||
Examples of **incorrect** code for this rule: | ||
|
||
```ts | ||
import { BehaviorSubject } from "rxjs"; | ||
const subject = new BehaviorSubject<number>(42); | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```ts | ||
import { BehaviorSubject } from "rxjs"; | ||
const subject = new BehaviorSubject(42); | ||
``` | ||
|
||
## Options | ||
|
||
This rule has no options. |
Oops, something went wrong.