eslint-plugin-rxjs-x 0.7.7 → 0.8.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 +100 -64
- package/dist/index.d.mts +272 -104
- package/dist/index.d.ts +272 -104
- package/dist/index.js +212 -48
- package/dist/index.mjs +212 -48
- package/package.json +16 -15
package/README.md
CHANGED
|
@@ -7,32 +7,70 @@ This ESLint plugin is intended to prevent issues with [RxJS](https://github.com/
|
|
|
7
7
|
|
|
8
8
|
Most of these rules require TypeScript typed linting and are indicated as such below.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Migration Guide from `eslint-plugin-rxjs`
|
|
11
11
|
|
|
12
|
-
This project
|
|
13
|
-
|
|
14
|
-
There are some breaking changes:
|
|
12
|
+
This project started as a fork of [`eslint-plugin-rxjs`](https://github.com/cartant/eslint-plugin-rxjs)
|
|
13
|
+
but has since introduced new features which involve breaking changes.
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
- The rule `rxjs/no-ignored-observable` is renamed to `rxjs-x/no-floating-observables`.
|
|
15
|
+
1. Migrate your config from the old `.eslintrc` format to `eslint.config.mjs` (or similar), and uninstall `eslint-plugin-rxjs`.
|
|
16
|
+
- See ESLint's guide here: [https://eslint.org/docs/latest/use/configure/migration-guide].
|
|
17
|
+
- If you need to continue using the deprecated format, use the original `eslint-plugin-rxjs` or a different fork.
|
|
18
|
+
2. Install `eslint-plugin-rxjs-x`, and import it into your config.
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
```diff
|
|
21
|
+
+ import rxjsX from 'eslint-plugin-rxjs-x';
|
|
22
|
+
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
3. If you previously used the `plugin:rxjs/recommended` shared config, add `rxjsX.configs.recommended` to your `configs` block:
|
|
25
|
+
|
|
26
|
+
```diff
|
|
27
|
+
configs: {
|
|
28
|
+
+ rxjsX.configs.recommended,
|
|
29
|
+
},
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Note: `eslint-plugin-rxjs-x` provides a `strict` shared config, so consider using `rxjsX.configs.strict` instead.
|
|
33
|
+
4. If you previously did _not_ use a shared config, add the plugin to your `plugins` block with the new namespace:
|
|
34
|
+
|
|
35
|
+
```diff
|
|
36
|
+
plugins: {
|
|
37
|
+
+ 'rxjs-x': rxjsX,
|
|
38
|
+
},
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- Note: this is unnecessary if you are using a shared config.
|
|
42
|
+
5. In your `rules` block, replace the namespace `rxjs` with `rxjs-x`:
|
|
43
|
+
|
|
44
|
+
```diff
|
|
45
|
+
- 'rxjs/no-subject-value': 'error',
|
|
46
|
+
+ 'rxjs-x/no-subject-value': 'error',
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
6. If you previously used `rxjs/no-ignored-observable`, replace it with `rxjs-x/no-floating-observables`.
|
|
50
|
+
|
|
51
|
+
```diff
|
|
52
|
+
- 'rxjs/no-ignored-observable': 'error',
|
|
53
|
+
+ 'rxjs-x/no-floating-observables': 'error',
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
> [!TIP]
|
|
57
|
+
> A complete description of all changes are documented in the [CHANGELOG](CHANGELOG.md) file.
|
|
58
|
+
|
|
59
|
+
## Installation Guide
|
|
25
60
|
|
|
26
61
|
See [typescript-eslint's Getting Started](https://typescript-eslint.io/getting-started) for a full ESLint setup guide.
|
|
27
62
|
|
|
28
|
-
|
|
63
|
+
1. Enable typed linting.
|
|
64
|
+
- See [Linting with Type Information](https://typescript-eslint.io/getting-started/typed-linting/) for more information.
|
|
65
|
+
2. Start with the `recommended` shared config in your `eslint.config.mjs`.
|
|
29
66
|
|
|
30
67
|
```js
|
|
31
68
|
// @ts-check
|
|
69
|
+
import { defineConfig } from 'eslint/config';
|
|
32
70
|
import tseslint from 'typescript-eslint';
|
|
33
71
|
import rxjsX from 'eslint-plugin-rxjs-x';
|
|
34
72
|
|
|
35
|
-
export default
|
|
73
|
+
export default defineConfig({
|
|
36
74
|
extends: [
|
|
37
75
|
...tseslint.configs.recommended,
|
|
38
76
|
rxjsX.configs.recommended,
|
|
@@ -45,10 +83,6 @@ export default tseslint.config({
|
|
|
45
83
|
});
|
|
46
84
|
```
|
|
47
85
|
|
|
48
|
-
The above example uses `typescript-eslint`'s built-in config to set up the TypeScript parser for us.
|
|
49
|
-
Enabling `projectService` then turns on typed linting.
|
|
50
|
-
See [Linting with Type Information](https://typescript-eslint.io/getting-started/typed-linting/) for details.
|
|
51
|
-
|
|
52
86
|
## Configs
|
|
53
87
|
|
|
54
88
|
<!-- begin auto-generated configs list -->
|
|
@@ -74,52 +108,54 @@ The package includes the following rules.
|
|
|
74
108
|
💭 Requires [type information](https://typescript-eslint.io/linting/typed-linting).\
|
|
75
109
|
❌ Deprecated.
|
|
76
110
|
|
|
77
|
-
| Name
|
|
78
|
-
|
|
|
79
|
-
| [ban-observables](docs/rules/ban-observables.md)
|
|
80
|
-
| [ban-operators](docs/rules/ban-operators.md)
|
|
81
|
-
| [finnish](docs/rules/finnish.md)
|
|
82
|
-
| [just](docs/rules/just.md)
|
|
83
|
-
| [macro](docs/rules/macro.md)
|
|
84
|
-
| [no-async-subscribe](docs/rules/no-async-subscribe.md)
|
|
85
|
-
| [no-compat](docs/rules/no-compat.md)
|
|
86
|
-
| [no-connectable](docs/rules/no-connectable.md)
|
|
87
|
-
| [no-create](docs/rules/no-create.md)
|
|
88
|
-
| [no-cyclic-action](docs/rules/no-cyclic-action.md)
|
|
89
|
-
| [no-explicit-generics](docs/rules/no-explicit-generics.md)
|
|
90
|
-
| [no-exposed-subjects](docs/rules/no-exposed-subjects.md)
|
|
91
|
-
| [no-finnish](docs/rules/no-finnish.md)
|
|
92
|
-
| [no-floating-observables](docs/rules/no-floating-observables.md)
|
|
93
|
-
| [no-ignored-default-value](docs/rules/no-ignored-default-value.md)
|
|
94
|
-
| [no-ignored-error](docs/rules/no-ignored-error.md)
|
|
95
|
-
| [no-ignored-notifier](docs/rules/no-ignored-notifier.md)
|
|
96
|
-
| [no-ignored-replay-buffer](docs/rules/no-ignored-replay-buffer.md)
|
|
97
|
-
| [no-ignored-subscribe](docs/rules/no-ignored-subscribe.md)
|
|
98
|
-
| [no-ignored-subscription](docs/rules/no-ignored-subscription.md)
|
|
99
|
-
| [no-ignored-takewhile-value](docs/rules/no-ignored-takewhile-value.md)
|
|
100
|
-
| [no-implicit-any-catch](docs/rules/no-implicit-any-catch.md)
|
|
101
|
-
| [no-index](docs/rules/no-index.md)
|
|
102
|
-
| [no-internal](docs/rules/no-internal.md)
|
|
103
|
-
| [no-misused-observables](docs/rules/no-misused-observables.md)
|
|
104
|
-
| [no-nested-subscribe](docs/rules/no-nested-subscribe.md)
|
|
105
|
-
| [no-redundant-notify](docs/rules/no-redundant-notify.md)
|
|
106
|
-
| [no-sharereplay](docs/rules/no-sharereplay.md)
|
|
107
|
-
| [no-
|
|
108
|
-
| [no-
|
|
109
|
-
| [no-subject-
|
|
110
|
-
| [no-
|
|
111
|
-
| [no-subscribe-
|
|
112
|
-
| [no-
|
|
113
|
-
| [no-
|
|
114
|
-
| [no-
|
|
115
|
-
| [no-
|
|
116
|
-
| [no-
|
|
117
|
-
| [no-unsafe-
|
|
118
|
-
| [no-unsafe-
|
|
119
|
-
| [no-unsafe-
|
|
120
|
-
| [
|
|
121
|
-
| [
|
|
122
|
-
| [
|
|
123
|
-
| [
|
|
111
|
+
| Name | Description | 💼 | 🔧 | 💡 | 💭 | ❌ |
|
|
112
|
+
| :------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------- | :--- | :- | :- | :- | :- |
|
|
113
|
+
| [ban-observables](docs/rules/ban-observables.md) | Disallow banned observable creators. | | | | | |
|
|
114
|
+
| [ban-operators](docs/rules/ban-operators.md) | Disallow banned operators. | | | | 💭 | |
|
|
115
|
+
| [finnish](docs/rules/finnish.md) | Enforce Finnish notation. | | | | 💭 | |
|
|
116
|
+
| [just](docs/rules/just.md) | Require the use of `just` instead of `of`. | | 🔧 | | | |
|
|
117
|
+
| [macro](docs/rules/macro.md) | Require the use of the RxJS Tools Babel macro. | | 🔧 | | | ❌ |
|
|
118
|
+
| [no-async-subscribe](docs/rules/no-async-subscribe.md) | Disallow passing `async` functions to `subscribe`. | ✅ 🔒 | | | 💭 | |
|
|
119
|
+
| [no-compat](docs/rules/no-compat.md) | Disallow the `rxjs-compat` package. | | | | | ❌ |
|
|
120
|
+
| [no-connectable](docs/rules/no-connectable.md) | Disallow operators that return connectable observables. | | | | 💭 | |
|
|
121
|
+
| [no-create](docs/rules/no-create.md) | Disallow the static `Observable.create` function. | ✅ 🔒 | | | 💭 | |
|
|
122
|
+
| [no-cyclic-action](docs/rules/no-cyclic-action.md) | Disallow cyclic actions in effects and epics. | | | | 💭 | |
|
|
123
|
+
| [no-explicit-generics](docs/rules/no-explicit-generics.md) | Disallow unnecessary explicit generic type arguments. | | | | | |
|
|
124
|
+
| [no-exposed-subjects](docs/rules/no-exposed-subjects.md) | Disallow public and protected subjects. | 🔒 | | | 💭 | |
|
|
125
|
+
| [no-finnish](docs/rules/no-finnish.md) | Disallow Finnish notation. | | | | 💭 | |
|
|
126
|
+
| [no-floating-observables](docs/rules/no-floating-observables.md) | Require Observables to be handled appropriately. | 🔒 | | | 💭 | |
|
|
127
|
+
| [no-ignored-default-value](docs/rules/no-ignored-default-value.md) | Disallow using `firstValueFrom`, `lastValueFrom`, `first`, and `last` without specifying a default value. | 🔒 | | | 💭 | |
|
|
128
|
+
| [no-ignored-error](docs/rules/no-ignored-error.md) | Disallow calling `subscribe` without specifying an error handler. | 🔒 | | | 💭 | |
|
|
129
|
+
| [no-ignored-notifier](docs/rules/no-ignored-notifier.md) | Disallow observables not composed from the `repeatWhen` or `retryWhen` notifier. | ✅ 🔒 | | | 💭 | |
|
|
130
|
+
| [no-ignored-replay-buffer](docs/rules/no-ignored-replay-buffer.md) | Disallow using `ReplaySubject`, `publishReplay` or `shareReplay` without specifying the buffer size. | ✅ 🔒 | | | | |
|
|
131
|
+
| [no-ignored-subscribe](docs/rules/no-ignored-subscribe.md) | Disallow calling `subscribe` without specifying arguments. | | | | 💭 | |
|
|
132
|
+
| [no-ignored-subscription](docs/rules/no-ignored-subscription.md) | Disallow ignoring the subscription returned by `subscribe`. | | | | 💭 | |
|
|
133
|
+
| [no-ignored-takewhile-value](docs/rules/no-ignored-takewhile-value.md) | Disallow ignoring the value within `takeWhile`. | ✅ 🔒 | | | | |
|
|
134
|
+
| [no-implicit-any-catch](docs/rules/no-implicit-any-catch.md) | Disallow implicit `any` error parameters in `catchError` operators. | ✅ 🔒 | 🔧 | 💡 | 💭 | |
|
|
135
|
+
| [no-index](docs/rules/no-index.md) | Disallow importing index modules. | ✅ 🔒 | | | | |
|
|
136
|
+
| [no-internal](docs/rules/no-internal.md) | Disallow importing internal modules. | ✅ 🔒 | 🔧 | 💡 | | |
|
|
137
|
+
| [no-misused-observables](docs/rules/no-misused-observables.md) | Disallow Observables in places not designed to handle them. | 🔒 | | | 💭 | |
|
|
138
|
+
| [no-nested-subscribe](docs/rules/no-nested-subscribe.md) | Disallow calling `subscribe` within a `subscribe` callback. | ✅ 🔒 | | | 💭 | |
|
|
139
|
+
| [no-redundant-notify](docs/rules/no-redundant-notify.md) | Disallow sending redundant notifications from completed or errored observables. | ✅ 🔒 | | | 💭 | |
|
|
140
|
+
| [no-sharereplay](docs/rules/no-sharereplay.md) | Disallow unsafe `shareReplay` usage. | ✅ 🔒 | | | | |
|
|
141
|
+
| [no-sharereplay-before-takeuntil](docs/rules/no-sharereplay-before-takeuntil.md) | Disallow using `shareReplay({ refCount: false })` before `takeUntil`. | 🔒 | | | | |
|
|
142
|
+
| [no-subclass](docs/rules/no-subclass.md) | Disallow subclassing RxJS classes. | 🔒 | | | 💭 | |
|
|
143
|
+
| [no-subject-unsubscribe](docs/rules/no-subject-unsubscribe.md) | Disallow calling the `unsubscribe` method of subjects. | ✅ 🔒 | | | 💭 | |
|
|
144
|
+
| [no-subject-value](docs/rules/no-subject-value.md) | Disallow accessing the `value` property of a `BehaviorSubject` instance. | | | | 💭 | |
|
|
145
|
+
| [no-subscribe-handlers](docs/rules/no-subscribe-handlers.md) | Disallow passing handlers to `subscribe`. | | | | 💭 | |
|
|
146
|
+
| [no-subscribe-in-pipe](docs/rules/no-subscribe-in-pipe.md) | Disallow calling of `subscribe` within any RxJS operator inside a `pipe`. | ✅ 🔒 | | | 💭 | |
|
|
147
|
+
| [no-tap](docs/rules/no-tap.md) | Disallow the `tap` operator. | | | | | ❌ |
|
|
148
|
+
| [no-topromise](docs/rules/no-topromise.md) | Disallow use of the `toPromise` method. | ✅ 🔒 | | 💡 | 💭 | |
|
|
149
|
+
| [no-unbound-methods](docs/rules/no-unbound-methods.md) | Disallow passing unbound methods. | ✅ 🔒 | | | 💭 | |
|
|
150
|
+
| [no-unnecessary-collection](docs/rules/no-unnecessary-collection.md) | Disallow unnecessary usage of collection arguments with single values. | 🔒 | | | | |
|
|
151
|
+
| [no-unsafe-catch](docs/rules/no-unsafe-catch.md) | Disallow unsafe `catchError` usage in effects and epics. | | | | 💭 | |
|
|
152
|
+
| [no-unsafe-first](docs/rules/no-unsafe-first.md) | Disallow unsafe `first`/`take` usage in effects and epics. | | | | 💭 | |
|
|
153
|
+
| [no-unsafe-subject-next](docs/rules/no-unsafe-subject-next.md) | Disallow unsafe optional `next` calls. | ✅ 🔒 | | | 💭 | |
|
|
154
|
+
| [no-unsafe-switchmap](docs/rules/no-unsafe-switchmap.md) | Disallow unsafe `switchMap` usage in effects and epics. | | | | 💭 | |
|
|
155
|
+
| [no-unsafe-takeuntil](docs/rules/no-unsafe-takeuntil.md) | Disallow applying operators after `takeUntil`. | ✅ 🔒 | | | 💭 | |
|
|
156
|
+
| [prefer-observer](docs/rules/prefer-observer.md) | Disallow passing separate handlers to `subscribe` and `tap`. | ✅ 🔒 | 🔧 | 💡 | 💭 | |
|
|
157
|
+
| [prefer-root-operators](docs/rules/prefer-root-operators.md) | Disallow importing operators from `rxjs/operators`. | ✅ 🔒 | 🔧 | 💡 | | |
|
|
158
|
+
| [suffix-subjects](docs/rules/suffix-subjects.md) | Enforce the use of a suffix in subject identifiers. | | | | 💭 | |
|
|
159
|
+
| [throw-error](docs/rules/throw-error.md) | Enforce passing only `Error` values to `throwError` or `Subject.error`. | ✅ 🔒 | | | 💭 | |
|
|
124
160
|
|
|
125
161
|
<!-- end auto-generated rules list -->
|