eslint-plugin-rxjs-x 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -44
- package/dist/index.d.ts +1 -1
- package/dist/{index.cjs → index.js} +429 -344
- package/dist/index.mjs +424 -321
- package/docs/rules/ban-observables.md +3 -1
- package/docs/rules/ban-operators.md +3 -1
- package/docs/rules/finnish.md +21 -2
- package/docs/rules/just.md +5 -5
- package/docs/rules/macro.md +4 -4
- package/docs/rules/no-async-subscribe.md +7 -5
- package/docs/rules/no-compat.md +3 -5
- package/docs/rules/no-connectable.md +4 -4
- package/docs/rules/no-create.md +7 -5
- package/docs/rules/no-cyclic-action.md +14 -2
- package/docs/rules/no-explicit-generics.md +3 -5
- package/docs/rules/no-exposed-subjects.md +14 -2
- package/docs/rules/no-finnish.md +6 -6
- package/docs/rules/no-ignored-error.md +5 -5
- package/docs/rules/no-ignored-notifier.md +7 -5
- package/docs/rules/no-ignored-observable.md +5 -5
- package/docs/rules/no-ignored-replay-buffer.md +5 -5
- package/docs/rules/no-ignored-subscribe.md +5 -5
- package/docs/rules/no-ignored-subscription.md +5 -5
- package/docs/rules/no-ignored-takewhile-value.md +5 -5
- package/docs/rules/no-implicit-any-catch.md +18 -2
- package/docs/rules/no-index.md +5 -5
- package/docs/rules/no-internal.md +7 -5
- package/docs/rules/no-nested-subscribe.md +7 -5
- package/docs/rules/no-redundant-notify.md +7 -5
- package/docs/rules/no-sharereplay.md +14 -2
- package/docs/rules/no-subclass.md +4 -4
- package/docs/rules/no-subject-unsubscribe.md +7 -5
- package/docs/rules/no-subject-value.md +4 -4
- package/docs/rules/no-subscribe-handlers.md +5 -7
- package/docs/rules/no-tap.md +4 -4
- package/docs/rules/no-topromise.md +4 -4
- package/docs/rules/no-unbound-methods.md +7 -8
- package/docs/rules/no-unsafe-catch.md +13 -1
- package/docs/rules/no-unsafe-first.md +13 -1
- package/docs/rules/no-unsafe-subject-next.md +7 -5
- package/docs/rules/no-unsafe-switchmap.md +15 -1
- package/docs/rules/no-unsafe-takeuntil.md +16 -1
- package/docs/rules/prefer-observer.md +15 -1
- package/docs/rules/suffix-subjects.md +17 -1
- package/docs/rules/throw-error.md +5 -5
- package/package.json +23 -16
- package/dist/index.d.cts +0 -121
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow banned observable creators (`rxjs-x/ban-observables`)
|
|
2
|
+
|
|
3
|
+
<!-- end auto-generated rule header -->
|
|
2
4
|
|
|
3
5
|
This rule can be configured so that developers can ban any observable creators they want to avoid in their project.
|
|
4
6
|
|
package/docs/rules/finnish.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Enforce Finnish notation (`rxjs-x/finnish`)
|
|
2
|
+
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
This rule enforces the use of Finnish notation - i.e. the `$` suffix.
|
|
4
8
|
|
|
@@ -18,9 +22,24 @@ const answer$ = of(42, 54);
|
|
|
18
22
|
|
|
19
23
|
## Options
|
|
20
24
|
|
|
25
|
+
<!-- begin auto-generated rule options list -->
|
|
26
|
+
|
|
27
|
+
| Name | Description | Type |
|
|
28
|
+
| :----------- | :------------------------------------------------------------------- | :------ |
|
|
29
|
+
| `functions` | Require for functions. | Boolean |
|
|
30
|
+
| `methods` | Require for methods. | Boolean |
|
|
31
|
+
| `names` | Enforce for specific names. Keys are a RegExp, values are a boolean. | Object |
|
|
32
|
+
| `parameters` | Require for parameters. | Boolean |
|
|
33
|
+
| `properties` | Require for properties. | Boolean |
|
|
34
|
+
| `strict` | Disallow Finnish notation for non-Observables. | Boolean |
|
|
35
|
+
| `types` | Enforce for specific types. Keys are a RegExp, values are a boolean. | Object |
|
|
36
|
+
| `variables` | Require for variables. | Boolean |
|
|
37
|
+
|
|
38
|
+
<!-- end auto-generated rule options list -->
|
|
39
|
+
|
|
21
40
|
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:
|
|
22
41
|
|
|
23
|
-
- `names` and `types` properties that determine whether
|
|
42
|
+
- `names` and `types` properties that determine whether or not Finnish notation is to be enforced for specific names or types.
|
|
24
43
|
- a `strict` property that, if `true`, allows the `$` suffix to be used _only_ with identifiers that have an `Observable` type.
|
|
25
44
|
|
|
26
45
|
The default (Angular-friendly) configuration looks like this:
|
package/docs/rules/just.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Require the use of `just` instead of `of` (`rxjs-x/just`)
|
|
2
2
|
|
|
3
|
-
This rule
|
|
3
|
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
6
|
|
|
7
|
-
This rule
|
|
7
|
+
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.
|
|
8
8
|
|
|
9
9
|
## Further reading
|
|
10
10
|
|
|
11
|
-
- [Rename `of` to `just`](https://github.com/ReactiveX/rxjs/issues/3747)
|
|
11
|
+
- [Rename `of` to `just`](https://github.com/ReactiveX/rxjs/issues/3747)
|
package/docs/rules/macro.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Require the use of the RxJS Tools Babel macro (`rxjs-x/macro`)
|
|
2
2
|
|
|
3
|
-
This rule
|
|
3
|
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
6
|
|
|
7
|
-
This rule
|
|
7
|
+
This rule ensures that modules that import `rxjs` also import the Babel macro for [RxJS Tools](https://rxjs.tools).
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow passing `async` functions to `subscribe` (`rxjs-x/no-async-subscribe`)
|
|
2
|
+
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
|
+
|
|
5
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
6
|
+
|
|
7
|
+
<!-- end auto-generated rule header -->
|
|
2
8
|
|
|
3
9
|
This rule effects failures if async functions are passed to `subscribe`.
|
|
4
10
|
|
|
@@ -18,10 +24,6 @@ import { of } from "rxjs";
|
|
|
18
24
|
of(42).subscribe(() => console.log(value));
|
|
19
25
|
```
|
|
20
26
|
|
|
21
|
-
## Options
|
|
22
|
-
|
|
23
|
-
This rule has no options.
|
|
24
|
-
|
|
25
27
|
## Further reading
|
|
26
28
|
|
|
27
29
|
- [Why does this rule exist?](https://stackoverflow.com/q/71559135)
|
package/docs/rules/no-compat.md
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow the `rxjs-compat` package (`rxjs-x/no-compat`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<!-- end auto-generated rule header -->
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This rule has no options.
|
|
5
|
+
This rule prevents importing from locations that depend upon the `rxjs-compat` package.
|
|
8
6
|
|
|
9
7
|
## Further reading
|
|
10
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow operators that return connectable observables (`rxjs-x/no-connectable`)
|
|
2
2
|
|
|
3
|
-
This rule
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
6
|
|
|
7
|
-
This rule
|
|
7
|
+
This rule prevents the use of connectable observables.
|
package/docs/rules/no-create.md
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow the static `Observable.create` function (`rxjs-x/no-create`)
|
|
2
|
+
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
|
+
|
|
5
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
6
|
+
|
|
7
|
+
<!-- end auto-generated rule header -->
|
|
2
8
|
|
|
3
9
|
This rule prevents the use of the static `create` function in `Observable`. Developers should use `new` and the constructor instead.
|
|
4
10
|
|
|
@@ -23,7 +29,3 @@ const answers = new Observable<number>(subscriber => {
|
|
|
23
29
|
subscriber.complete();
|
|
24
30
|
});
|
|
25
31
|
```
|
|
26
|
-
|
|
27
|
-
## Options
|
|
28
|
-
|
|
29
|
-
This rule has no options.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow cyclic actions in effects and epics (`rxjs-x/no-cyclic-action`)
|
|
2
|
+
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
This rule effects failures for effects and epics that emit actions that would pass their `ofType` filter. Such actions are cyclic and, upon emission, immediately re-trigger the effect or epic.
|
|
4
8
|
|
|
@@ -22,7 +26,7 @@ actions.pipe(
|
|
|
22
26
|
);
|
|
23
27
|
```
|
|
24
28
|
|
|
25
|
-
This rule can be used with effects _and epics_, so it makes
|
|
29
|
+
This rule can be used with effects _and epics_, so it makes **no attempt** to discern whether or not dispatching is disabled for an NgRx effect. That is, code like this will effect (🙈) a failure:
|
|
26
30
|
|
|
27
31
|
```ts
|
|
28
32
|
someEffect = createEffect(() =>
|
|
@@ -50,6 +54,14 @@ Or you can use an ESLint [inline comment](https://eslint.org/docs/user-guide/con
|
|
|
50
54
|
|
|
51
55
|
## Options
|
|
52
56
|
|
|
57
|
+
<!-- begin auto-generated rule options list -->
|
|
58
|
+
|
|
59
|
+
| Name | Description | Type | Default |
|
|
60
|
+
| :----------- | :------------------------------------------------------------ | :----- | :----------------------- |
|
|
61
|
+
| `observable` | A RegExp that matches an effect or epic's actions observable. | String | `[Aa]ction(s\|s\$\|\$)$` |
|
|
62
|
+
|
|
63
|
+
<!-- end auto-generated rule options list -->
|
|
64
|
+
|
|
53
65
|
This rule accepts a single option which is an object with an `observable` property that is a regular expression used to match an effect or epic's actions observable. The default `observable` regular expression should match most effect and epic action sources.
|
|
54
66
|
|
|
55
67
|
```json
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow unnecessary explicit generic type arguments (`rxjs-x/no-explicit-generics`)
|
|
2
|
+
|
|
3
|
+
<!-- end auto-generated rule header -->
|
|
2
4
|
|
|
3
5
|
This rule prevents the use of explicit type arguments when the type arguments can be inferred.
|
|
4
6
|
|
|
@@ -17,7 +19,3 @@ Examples of **correct** code for this rule:
|
|
|
17
19
|
import { BehaviorSubject } from "rxjs";
|
|
18
20
|
const subject = new BehaviorSubject(42);
|
|
19
21
|
```
|
|
20
|
-
|
|
21
|
-
## Options
|
|
22
|
-
|
|
23
|
-
This rule has no options.
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow public and protected subjects (`rxjs-x/no-exposed-subjects`)
|
|
2
2
|
|
|
3
|
-
This rule
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
|
+
|
|
7
|
+
This rule prevents exposed (i.e. non-private) subjects. Developers should instead expose observables via the subjects' `toObservable` method.
|
|
4
8
|
|
|
5
9
|
## Rule details
|
|
6
10
|
|
|
@@ -27,6 +31,14 @@ class Answers {
|
|
|
27
31
|
|
|
28
32
|
## Options
|
|
29
33
|
|
|
34
|
+
<!-- begin auto-generated rule options list -->
|
|
35
|
+
|
|
36
|
+
| Name | Description | Type | Default |
|
|
37
|
+
| :--------------- | :------------------------ | :------ | :------ |
|
|
38
|
+
| `allowProtected` | Allow protected subjects. | Boolean | `false` |
|
|
39
|
+
|
|
40
|
+
<!-- end auto-generated rule options list -->
|
|
41
|
+
|
|
30
42
|
This rule accepts a single option which is an object with an `allowProtected` property that determines whether or not protected subjects are allowed. By default, they are not.
|
|
31
43
|
|
|
32
44
|
```json
|
package/docs/rules/no-finnish.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow Finnish notation (`rxjs-x/no-finnish`)
|
|
2
|
+
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
This rule prevents the use of Finnish notation.
|
|
4
8
|
|
|
@@ -16,10 +20,6 @@ Examples of **correct** code for this rule:
|
|
|
16
20
|
const answers = of(42, 54);
|
|
17
21
|
```
|
|
18
22
|
|
|
19
|
-
## Options
|
|
20
|
-
|
|
21
|
-
This rule has no options.
|
|
22
|
-
|
|
23
23
|
## Further reading
|
|
24
24
|
|
|
25
|
-
- [Observables and Finnish Notation](https://medium.com/@benlesh/observables-and-finnish-notation-df8356ed1c9b)
|
|
25
|
+
- [Observables and Finnish Notation](https://medium.com/@benlesh/observables-and-finnish-notation-df8356ed1c9b)
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow calling `subscribe` without specifying an error handler (`rxjs-x/no-ignored-error`)
|
|
2
|
+
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
This rule enforces the passing of an error handler to `subscribe` calls.
|
|
4
8
|
|
|
@@ -31,7 +35,3 @@ source.subscribe({
|
|
|
31
35
|
error: (error) => console.error(error)
|
|
32
36
|
});
|
|
33
37
|
```
|
|
34
|
-
|
|
35
|
-
## Options
|
|
36
|
-
|
|
37
|
-
This rule has no options.
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow observables not composed from the `repeatWhen` or `retryWhen` notifier (`rxjs-x/no-ignored-notifier`)
|
|
2
|
+
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
|
+
|
|
5
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
6
|
+
|
|
7
|
+
<!-- end auto-generated rule header -->
|
|
2
8
|
|
|
3
9
|
This rule effects failures if the notifier passed to a `repeatWhen` or `retryWhen` callback is not used.
|
|
4
10
|
|
|
@@ -24,7 +30,3 @@ const repeating = source.pipe(
|
|
|
24
30
|
repeatWhen(notifications => notifications.pipe(take(3)))
|
|
25
31
|
);
|
|
26
32
|
```
|
|
27
|
-
|
|
28
|
-
## Options
|
|
29
|
-
|
|
30
|
-
This rule has no options.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow ignoring observables returned by functions (`rxjs-x/no-ignored-observable`)
|
|
2
|
+
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
The effects failures if an observable returned by a function is neither assigned to a variable or property or passed to a function.
|
|
4
8
|
|
|
@@ -17,7 +21,3 @@ Examples of **correct** code for this rule:
|
|
|
17
21
|
import { of } from "rxjs";
|
|
18
22
|
const answers = of(42, 54);
|
|
19
23
|
```
|
|
20
|
-
|
|
21
|
-
## Options
|
|
22
|
-
|
|
23
|
-
This rule has no options.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow using `ReplaySubject`, `publishReplay` or `shareReplay` without specifying the buffer size (`rxjs-x/no-ignored-replay-buffer`)
|
|
2
|
+
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
This rule effects failures if the buffer size of a replay buffer is not explicitly specified.
|
|
4
8
|
|
|
@@ -22,7 +26,3 @@ const subject = new ReplaySubject<number>(1);
|
|
|
22
26
|
import { ReplaySubject } from "rxjs";
|
|
23
27
|
const subject = new ReplaySubject<number>(Infinity);
|
|
24
28
|
```
|
|
25
|
-
|
|
26
|
-
## Options
|
|
27
|
-
|
|
28
|
-
This rule has no options.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow calling `subscribe` without specifying arguments (`rxjs-x/no-ignored-subscribe`)
|
|
2
|
+
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
This rule effects failures whenever `subscribe` is called without handlers.
|
|
4
8
|
|
|
@@ -22,7 +26,3 @@ import { of } from "rxjs";
|
|
|
22
26
|
|
|
23
27
|
of(42, 54).subscribe((value) => console.log(value));
|
|
24
28
|
```
|
|
25
|
-
|
|
26
|
-
## Options
|
|
27
|
-
|
|
28
|
-
This rule has no options.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow ignoring the subscription returned by `subscribe` (`rxjs-x/no-ignored-subscription`)
|
|
2
|
+
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
The effects failures if an subscription returned by call to `subscribe` is neither assigned to a variable or property or passed to a function.
|
|
4
8
|
|
|
@@ -27,7 +31,3 @@ const numbers = new Observable<number>(subscriber => {
|
|
|
27
31
|
interval(1e3).subscribe(subscriber);
|
|
28
32
|
});
|
|
29
33
|
```
|
|
30
|
-
|
|
31
|
-
## Options
|
|
32
|
-
|
|
33
|
-
This rule has no options.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow ignoring the value within `takeWhile` (`rxjs-x/no-ignored-takewhile-value`)
|
|
2
|
+
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
This rule effects failures if the value received by a `takeWhile` callback is not used in an expression.
|
|
4
8
|
|
|
@@ -20,7 +24,3 @@ import { takeWhile } from "rxjs/operators";
|
|
|
20
24
|
|
|
21
25
|
const whilst = source.pipe(takeWhile(value => value));
|
|
22
26
|
```
|
|
23
|
-
|
|
24
|
-
## Options
|
|
25
|
-
|
|
26
|
-
This rule has no options.
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow implicit `any` error parameters in `catchError` operators (`rxjs-x/no-implicit-any-catch`)
|
|
2
2
|
|
|
3
|
-
This rule
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
|
+
|
|
5
|
+
🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
|
|
6
|
+
|
|
7
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
8
|
+
|
|
9
|
+
<!-- end auto-generated rule header -->
|
|
10
|
+
|
|
11
|
+
This rule requires an explicit type annotation for error parameters in error handlers. It's similar to the typescript-eslint [`use-unknown-in-catch-callback-variable`](https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable/) rule or the TSConfig [`useUnknownInCatchVariables`](https://www.typescriptlang.org/tsconfig/#useUnknownInCatchVariables) option, but is for observables - not `try`/`catch` statements.
|
|
4
12
|
|
|
5
13
|
## Rule details
|
|
6
14
|
|
|
@@ -62,6 +70,14 @@ throwError(() => new Error("Kaboom!")).pipe(
|
|
|
62
70
|
|
|
63
71
|
## Options
|
|
64
72
|
|
|
73
|
+
<!-- begin auto-generated rule options list -->
|
|
74
|
+
|
|
75
|
+
| Name | Description | Type | Default |
|
|
76
|
+
| :----------------- | :---------------------------------------------------- | :------ | :------ |
|
|
77
|
+
| `allowExplicitAny` | Allow error variable to be explicitly typed as `any`. | Boolean | `false` |
|
|
78
|
+
|
|
79
|
+
<!-- end auto-generated rule options list -->
|
|
80
|
+
|
|
65
81
|
This rule accepts a single option which is an object with an `allowExplicitAny` property that determines whether or not the error variable can be explicitly typed as `any`. By default, the use of explicit `any` is forbidden.
|
|
66
82
|
|
|
67
83
|
```json
|
package/docs/rules/no-index.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow importing index modules (`rxjs-x/no-index`)
|
|
2
|
+
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
This rule effects failures if an index module is specified as the import location.
|
|
4
8
|
|
|
@@ -15,7 +19,3 @@ Examples of **correct** code for this rule:
|
|
|
15
19
|
```ts
|
|
16
20
|
import { of } from "rxjs";
|
|
17
21
|
```
|
|
18
|
-
|
|
19
|
-
## Options
|
|
20
|
-
|
|
21
|
-
This rule has no options.
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow importing internal modules (`rxjs-x/no-internal`)
|
|
2
|
+
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
|
+
|
|
5
|
+
🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
|
|
6
|
+
|
|
7
|
+
<!-- end auto-generated rule header -->
|
|
2
8
|
|
|
3
9
|
This rule effects failures if an internal module is specified as the import location.
|
|
4
10
|
|
|
@@ -15,7 +21,3 @@ Examples of **correct** code for this rule:
|
|
|
15
21
|
```ts
|
|
16
22
|
import { of } from "rxjs";
|
|
17
23
|
```
|
|
18
|
-
|
|
19
|
-
## Options
|
|
20
|
-
|
|
21
|
-
This rule has no options.
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow calling `subscribe` within a `subscribe` callback (`rxjs-x/no-nested-subscribe`)
|
|
2
|
+
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
|
+
|
|
5
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
6
|
+
|
|
7
|
+
<!-- end auto-generated rule header -->
|
|
2
8
|
|
|
3
9
|
This rule effects failures if `subscribe` is called within a `subscribe` handler.
|
|
4
10
|
|
|
@@ -24,7 +30,3 @@ of(42, 54).pipe(
|
|
|
24
30
|
mergeMap((value) => timer(1e3).pipe(mapTo(value)))
|
|
25
31
|
).subscribe((value) => console.log(value));
|
|
26
32
|
```
|
|
27
|
-
|
|
28
|
-
## Options
|
|
29
|
-
|
|
30
|
-
This rule has no options.
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow sending redundant notifications from completed or errored observables (`rxjs-x/no-redundant-notify`)
|
|
2
|
+
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
|
+
|
|
5
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
6
|
+
|
|
7
|
+
<!-- end auto-generated rule header -->
|
|
2
8
|
|
|
3
9
|
This rule effects failures if an attempt is made to send a notification to an observer after a `complete` or `error` notification has already been sent.
|
|
4
10
|
|
|
@@ -26,7 +32,3 @@ const subject = new Subject<number>();
|
|
|
26
32
|
subject.next(42);
|
|
27
33
|
subject.error(new Error("Kaboom!"));
|
|
28
34
|
```
|
|
29
|
-
|
|
30
|
-
## Options
|
|
31
|
-
|
|
32
|
-
This rule has no options.
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow unsafe `shareReplay` usage (`rxjs-x/no-sharereplay`)
|
|
2
|
+
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
This rule effects failures if the `shareReplay` operator is used - or if it is used without specifying a `config` argument.
|
|
4
8
|
|
|
5
|
-
The
|
|
9
|
+
The behavior of `shareReplay` has changed several times - see the blog post linked below.
|
|
6
10
|
|
|
7
11
|
## Options
|
|
8
12
|
|
|
13
|
+
<!-- begin auto-generated rule options list -->
|
|
14
|
+
|
|
15
|
+
| Name | Description | Type | Default |
|
|
16
|
+
| :------------ | :--------------------------------------------------- | :------ | :------ |
|
|
17
|
+
| `allowConfig` | Allow shareReplay if a config argument is specified. | Boolean | `true` |
|
|
18
|
+
|
|
19
|
+
<!-- end auto-generated rule options list -->
|
|
20
|
+
|
|
9
21
|
This rule accepts a single option which is an object with an `allowConfig` property that that determines whether `shareReplay` is allow if a config argument is specified. By default, `allowConfig` is `true`.
|
|
10
22
|
|
|
11
23
|
```json
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow subclassing RxJS classes (`rxjs-x/no-subclass`)
|
|
2
2
|
|
|
3
|
-
This rule
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
6
|
|
|
7
|
-
This rule
|
|
7
|
+
This rule effects failures if an RxJS class is subclassed. Developers are encouraged to avoid subclassing RxJS classes, as some public and protected implementation details might change in the future.
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow calling the `unsubscribe` method of subjects (`rxjs-x/no-subject-unsubscribe`)
|
|
2
2
|
|
|
3
|
-
This rule
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<!-- end auto-generated rule header -->
|
|
8
|
+
|
|
9
|
+
This rule effects failures if the `unsubscribe` method is called on subjects. The method behaves differently to the `unsubscribe` method on subscriptions and is often an error.
|
|
8
10
|
|
|
9
11
|
## Further reading
|
|
10
12
|
|
|
11
|
-
- [Closed Subjects](https://ncjamieson.com/closed-subjects/)
|
|
13
|
+
- [Closed Subjects](https://ncjamieson.com/closed-subjects/)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow accessing the `value` property of a `BehaviorSubject` instance (`rxjs-x/no-subject-value`)
|
|
2
2
|
|
|
3
|
-
This rule
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
6
|
|
|
7
|
-
This rule
|
|
7
|
+
This rule effects an error if the `value` property - or `getValue` method - of a `BehaviorSubject` is used.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow passing handlers to `subscribe` (`rxjs-x/no-subscribe-handlers`)
|
|
2
|
+
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
2
6
|
|
|
3
7
|
This rule effects failures whenever `subscribe` is called with handlers.
|
|
4
8
|
|
|
@@ -13,7 +17,6 @@ import { tap } from "rxjs/operators";
|
|
|
13
17
|
of(42, 54).subscribe((value) => console.log(value));
|
|
14
18
|
```
|
|
15
19
|
|
|
16
|
-
<!-- prettier-ignore -->
|
|
17
20
|
```ts
|
|
18
21
|
import { of } from "rxjs";
|
|
19
22
|
import { tap } from "rxjs/operators";
|
|
@@ -25,7 +28,6 @@ of(42, 54).subscribe({
|
|
|
25
28
|
|
|
26
29
|
Examples of **correct** code for this rule:
|
|
27
30
|
|
|
28
|
-
<!-- prettier-ignore -->
|
|
29
31
|
```ts
|
|
30
32
|
import { of } from "rxjs";
|
|
31
33
|
|
|
@@ -33,7 +35,3 @@ of(42, 54)
|
|
|
33
35
|
.pipe(tap((value) => console.log(value)))
|
|
34
36
|
.subscribe();
|
|
35
37
|
```
|
|
36
|
-
|
|
37
|
-
## Options
|
|
38
|
-
|
|
39
|
-
This rule has no options.
|
package/docs/rules/no-tap.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow the `tap` operator (`rxjs-x/no-tap`)
|
|
2
2
|
|
|
3
|
-
This rule
|
|
3
|
+
❌ This rule is deprecated. It was replaced by [`rxjs-x/ban-operators`](ban-operators.md).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
6
|
|
|
7
|
-
This rule
|
|
7
|
+
This rule effects failures if the `tap` operator is used.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Disallow use of the `toPromise` method (`rxjs-x/no-topromise`)
|
|
2
2
|
|
|
3
|
-
This rule
|
|
3
|
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
6
|
|
|
7
|
-
This rule
|
|
7
|
+
This rule effects failures if the `toPromise` method is used.
|