eslint-plugin-rxjs-x 0.9.4 β 1.0.0
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 +60 -104
- package/dist/index.d.ts +346 -385
- package/dist/index.js +3329 -4370
- package/package.json +34 -39
- package/dist/index.d.mts +0 -393
- package/dist/index.mjs +0 -4576
package/README.md
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/eslint-plugin-rxjs-x)
|
|
5
5
|
[](https://scorecard.dev/viewer/?uri=github.com/JasonWeinzierl/eslint-plugin-rxjs-x)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> [!NOTE]
|
|
8
|
+
> Forked from [`eslint-plugin-rxjs`](https://github.com/cartant/eslint-plugin-rxjs)
|
|
9
|
+
> as the original repository seems [no longer maintained](https://github.com/cartant/eslint-plugin-rxjs/issues/127).
|
|
10
|
+
|
|
11
|
+
This ESLint plugin is intended to prevent issues with [RxJS 7](https://github.com/ReactiveX/rxjs/tree/7.x).
|
|
8
12
|
|
|
9
13
|
Most of these rules require TypeScript typed linting and are indicated as such below.
|
|
10
14
|
|
|
@@ -39,60 +43,17 @@ See [typescript-eslint's Getting Started](https://typescript-eslint.io/getting-s
|
|
|
39
43
|
|
|
40
44
|
Additionally, consider if the `rxjsX.configs.strict` shared config is right for your project.
|
|
41
45
|
|
|
42
|
-
##
|
|
46
|
+
## Notable Changes from `eslint-plugin-rxjs`
|
|
47
|
+
|
|
48
|
+
1. eslintrc is not supported.
|
|
49
|
+
2. The namespace of this plugin is `rxjs-x` instead of `rxjs`.
|
|
50
|
+
- e.g. if your ESLint config had `"rxjs/no-subject-value": "error"`, replace it with `"rxjs-x/no-subject-value": "error"`.
|
|
51
|
+
- e.g. if your project had inline comments like `// eslint-disable-next-line rxjs/no-async-subscribe`, replace them with `// eslint-disable-next-line rxjs-x/no-async-subscribe`.
|
|
52
|
+
3. `rxjs/no-ignored-observable` is replaced with `rxjs-x/no-floating-observable`.
|
|
43
53
|
|
|
44
54
|
> [!TIP]
|
|
45
55
|
> A complete description of all changes from `eslint-plugin-rxjs` are documented in the [CHANGELOG](CHANGELOG.md) file.
|
|
46
56
|
|
|
47
|
-
This project started as a fork of [`eslint-plugin-rxjs`](https://github.com/cartant/eslint-plugin-rxjs)
|
|
48
|
-
but is still compatible with the eslintrc configuration format.
|
|
49
|
-
|
|
50
|
-
> [!WARNING]
|
|
51
|
-
> eslintrc compatibility will be removed in v1.
|
|
52
|
-
> Users are highly encouraged to upgrade to ESLint's flat configuration format.
|
|
53
|
-
> See: [https://eslint.org/docs/latest/use/configure/migration-guide]
|
|
54
|
-
|
|
55
|
-
1. Install `eslint-plugin-rxjs-x` using your preferred package manager.
|
|
56
|
-
2. If you previously used the `plugin:rxjs/recommended` shared config,
|
|
57
|
-
replace it with `plugin:rxjs-x/recommended-legacy`:
|
|
58
|
-
|
|
59
|
-
```diff
|
|
60
|
-
"extends": [
|
|
61
|
-
"plugin:@typescript-eslint/recommended",
|
|
62
|
-
- "plugin:rxjs/recommended",
|
|
63
|
-
+ "plugin:rxjs-x/recommended-legacy",
|
|
64
|
-
],
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
3. If you previously did _not_ use a shared config,
|
|
68
|
-
then replace the `rxjs` plugin to your `plugins` block:
|
|
69
|
-
|
|
70
|
-
```diff
|
|
71
|
-
"plugins": [
|
|
72
|
-
"@typescript-eslint",
|
|
73
|
-
- "rxjs",
|
|
74
|
-
+ "rxjs-x",
|
|
75
|
-
],
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
- Note: this is unnecessary if you are using the `recommended-legacy` shared config.
|
|
79
|
-
4. In your `rules` blocks, replace the namespace `rxjs` with `rxjs-x` for all rules:
|
|
80
|
-
|
|
81
|
-
```diff
|
|
82
|
-
"rules": {
|
|
83
|
-
- "rxjs/no-subject-value": "error",
|
|
84
|
-
+ "rxjs-x/no-subject-value": "error",
|
|
85
|
-
},
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
- Note: if your project has inline comments (e.g. `eslint-disable-next-line`) referencing `rxjs` rules, you must update the namespace there too.
|
|
89
|
-
5. If you previously used `rxjs/no-ignored-observable`, consider replacing it with `rxjs-x/no-floating-observables`. `no-ignored-observable` will be removed in v1.
|
|
90
|
-
|
|
91
|
-
```diff
|
|
92
|
-
- 'rxjs/no-ignored-observable': 'error',
|
|
93
|
-
+ 'rxjs-x/no-floating-observables': 'error',
|
|
94
|
-
```
|
|
95
|
-
|
|
96
57
|
## Configs
|
|
97
58
|
|
|
98
59
|
<!-- begin auto-generated configs list -->
|
|
@@ -115,58 +76,53 @@ The package includes the following rules.
|
|
|
115
76
|
π Set in the `strict` configuration.\
|
|
116
77
|
π§ Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
|
|
117
78
|
π‘ Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).\
|
|
118
|
-
π Requires [type information](https://typescript-eslint.io/linting/typed-linting)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
| [ban-
|
|
124
|
-
| [
|
|
125
|
-
| [
|
|
126
|
-
| [
|
|
127
|
-
| [
|
|
128
|
-
| [no-
|
|
129
|
-
| [no-
|
|
130
|
-
| [no-
|
|
131
|
-
| [no-
|
|
132
|
-
| [no-
|
|
133
|
-
| [no-
|
|
134
|
-
| [no-
|
|
135
|
-
| [no-
|
|
136
|
-
| [no-
|
|
137
|
-
| [no-ignored-
|
|
138
|
-
| [no-ignored-
|
|
139
|
-
| [no-ignored-
|
|
140
|
-
| [no-ignored-
|
|
141
|
-
| [no-
|
|
142
|
-
| [no-
|
|
143
|
-
| [no-
|
|
144
|
-
| [no-
|
|
145
|
-
| [no-
|
|
146
|
-
| [no-
|
|
147
|
-
| [no-
|
|
148
|
-
| [no-
|
|
149
|
-
| [no-
|
|
150
|
-
| [no-
|
|
151
|
-
| [no-
|
|
152
|
-
| [no-
|
|
153
|
-
| [no-
|
|
154
|
-
| [no-
|
|
155
|
-
| [no-
|
|
156
|
-
| [no-
|
|
157
|
-
| [no-
|
|
158
|
-
| [no-
|
|
159
|
-
| [no-
|
|
160
|
-
| [no-
|
|
161
|
-
| [no-
|
|
162
|
-
| [
|
|
163
|
-
| [
|
|
164
|
-
| [
|
|
165
|
-
| [
|
|
166
|
-
| [no-unsafe-takeuntil](docs/rules/no-unsafe-takeuntil.md) | Disallow applying operators after `takeUntil`. | β
π | | | π | |
|
|
167
|
-
| [prefer-observer](docs/rules/prefer-observer.md) | Disallow passing separate handlers to `subscribe` and `tap`. | β
π | π§ | π‘ | π | |
|
|
168
|
-
| [prefer-root-operators](docs/rules/prefer-root-operators.md) | Disallow importing operators from `rxjs/operators`. | β
π | π§ | π‘ | | |
|
|
169
|
-
| [suffix-subjects](docs/rules/suffix-subjects.md) | Enforce the use of a suffix in subject identifiers. | | | | π | |
|
|
170
|
-
| [throw-error](docs/rules/throw-error.md) | Enforce passing only `Error` values to `throwError` or `Subject.error`. | β
π | | π‘ | π | |
|
|
79
|
+
π Requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
80
|
+
|
|
81
|
+
| NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Description | πΌ | π§ | π‘ | π |
|
|
82
|
+
| :------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------- | :--- | :- | :- | :- |
|
|
83
|
+
| [ban-observables](docs/rules/ban-observables.md) | Disallow banned observable creators. | | | | |
|
|
84
|
+
| [ban-operators](docs/rules/ban-operators.md) | Disallow banned operators. | | | | π |
|
|
85
|
+
| [finnish](docs/rules/finnish.md) | Enforce Finnish notation. | | | | π |
|
|
86
|
+
| [just](docs/rules/just.md) | Require the use of `just` instead of `of`. | | π§ | | |
|
|
87
|
+
| [no-async-subscribe](docs/rules/no-async-subscribe.md) | Disallow passing `async` functions to `subscribe`. | β
π | | | π |
|
|
88
|
+
| [no-connectable](docs/rules/no-connectable.md) | Disallow operators that return connectable observables. | | | | π |
|
|
89
|
+
| [no-create](docs/rules/no-create.md) | Disallow the static `Observable.create` and `Subject.create` functions. | β
π | | | π |
|
|
90
|
+
| [no-cyclic-action](docs/rules/no-cyclic-action.md) | Disallow cyclic actions in effects and epics. | | | | π |
|
|
91
|
+
| [no-explicit-generics](docs/rules/no-explicit-generics.md) | Disallow unnecessary explicit generic type arguments. | | | | π |
|
|
92
|
+
| [no-exposed-subjects](docs/rules/no-exposed-subjects.md) | Disallow public and protected subjects. | π | | | π |
|
|
93
|
+
| [no-finnish](docs/rules/no-finnish.md) | Disallow Finnish notation. | | | | π |
|
|
94
|
+
| [no-floating-observables](docs/rules/no-floating-observables.md) | Require Observables to be handled appropriately. | π | | | π |
|
|
95
|
+
| [no-ignored-default-value](docs/rules/no-ignored-default-value.md) | Disallow using `firstValueFrom`, `lastValueFrom`, `first`, and `last` without specifying a default value. | π | | | π |
|
|
96
|
+
| [no-ignored-error](docs/rules/no-ignored-error.md) | Disallow calling `subscribe` without specifying an error handler. | π | | | π |
|
|
97
|
+
| [no-ignored-notifier](docs/rules/no-ignored-notifier.md) | Disallow observables not composed from the `repeatWhen` or `retryWhen` notifier. | β
π | | | π |
|
|
98
|
+
| [no-ignored-replay-buffer](docs/rules/no-ignored-replay-buffer.md) | Disallow using `ReplaySubject`, `publishReplay` or `shareReplay` without specifying the buffer size. | β
π | | | |
|
|
99
|
+
| [no-ignored-subscribe](docs/rules/no-ignored-subscribe.md) | Disallow calling `subscribe` without specifying arguments. | | | | π |
|
|
100
|
+
| [no-ignored-subscription](docs/rules/no-ignored-subscription.md) | Disallow ignoring the subscription returned by `subscribe`. | | | | π |
|
|
101
|
+
| [no-ignored-takewhile-value](docs/rules/no-ignored-takewhile-value.md) | Disallow ignoring the value within `takeWhile`. | β
π | | | |
|
|
102
|
+
| [no-implicit-any-catch](docs/rules/no-implicit-any-catch.md) | Disallow implicit `any` error parameters in `catchError`, `subscribe`, and `tap`. | β
π | π§ | π‘ | π |
|
|
103
|
+
| [no-index](docs/rules/no-index.md) | Disallow importing index modules. | β
π | | | |
|
|
104
|
+
| [no-internal](docs/rules/no-internal.md) | Disallow importing internal modules. | β
π | π§ | π‘ | |
|
|
105
|
+
| [no-misused-observables](docs/rules/no-misused-observables.md) | Disallow Observables in places not designed to handle them. | π | | | π |
|
|
106
|
+
| [no-nested-subscribe](docs/rules/no-nested-subscribe.md) | Disallow calling `subscribe` within a `subscribe` callback. | β
π | | | π |
|
|
107
|
+
| [no-redundant-notify](docs/rules/no-redundant-notify.md) | Disallow sending redundant notifications from completed or errored observables. | β
π | | | π |
|
|
108
|
+
| [no-sharereplay](docs/rules/no-sharereplay.md) | Disallow unsafe `shareReplay` usage. | β
π | | | |
|
|
109
|
+
| [no-sharereplay-before-takeuntil](docs/rules/no-sharereplay-before-takeuntil.md) | Disallow using `shareReplay({ refCount: false })` before `takeUntil`. | π | | | |
|
|
110
|
+
| [no-subclass](docs/rules/no-subclass.md) | Disallow subclassing RxJS classes. | π | | | π |
|
|
111
|
+
| [no-subject-unsubscribe](docs/rules/no-subject-unsubscribe.md) | Disallow calling the `unsubscribe` method of subjects. | β
π | | | π |
|
|
112
|
+
| [no-subject-value](docs/rules/no-subject-value.md) | Disallow accessing the `value` property of a `BehaviorSubject` instance. | | | | π |
|
|
113
|
+
| [no-subscribe-handlers](docs/rules/no-subscribe-handlers.md) | Disallow passing handlers to `subscribe`. | | | | π |
|
|
114
|
+
| [no-subscribe-in-pipe](docs/rules/no-subscribe-in-pipe.md) | Disallow calling of `subscribe` within any RxJS operator inside a `pipe`. | β
π | | | π |
|
|
115
|
+
| [no-topromise](docs/rules/no-topromise.md) | Disallow use of the `toPromise` method. | β
π | | π‘ | π |
|
|
116
|
+
| [no-unbound-methods](docs/rules/no-unbound-methods.md) | Disallow passing unbound methods. | β
π | | | π |
|
|
117
|
+
| [no-unnecessary-collection](docs/rules/no-unnecessary-collection.md) | Disallow unnecessary usage of collection arguments with single values. | π | | | |
|
|
118
|
+
| [no-unsafe-catch](docs/rules/no-unsafe-catch.md) | Disallow unsafe `catchError` usage in effects and epics. | | | | π |
|
|
119
|
+
| [no-unsafe-first](docs/rules/no-unsafe-first.md) | Disallow unsafe `first`/`take` usage in effects and epics. | | | | π |
|
|
120
|
+
| [no-unsafe-subject-next](docs/rules/no-unsafe-subject-next.md) | Disallow unsafe optional `next` calls. | β
π | | | π |
|
|
121
|
+
| [no-unsafe-switchmap](docs/rules/no-unsafe-switchmap.md) | Disallow unsafe `switchMap` usage in effects and epics. | | | | π |
|
|
122
|
+
| [no-unsafe-takeuntil](docs/rules/no-unsafe-takeuntil.md) | Disallow applying operators after `takeUntil`. | β
π | | | π |
|
|
123
|
+
| [prefer-observer](docs/rules/prefer-observer.md) | Disallow passing separate handlers to `subscribe` and `tap`. | β
π | π§ | π‘ | π |
|
|
124
|
+
| [prefer-root-operators](docs/rules/prefer-root-operators.md) | Disallow importing operators from `rxjs/operators`. | β
π | π§ | π‘ | |
|
|
125
|
+
| [suffix-subjects](docs/rules/suffix-subjects.md) | Enforce the use of a suffix in subject identifiers. | | | | π |
|
|
126
|
+
| [throw-error](docs/rules/throw-error.md) | Enforce passing only `Error` values to `throwError` or `Subject.error`. | β
π | | π‘ | π |
|
|
171
127
|
|
|
172
128
|
<!-- end auto-generated rules list -->
|