eslint-plugin-rxjs-x 0.8.5 → 0.9.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 +61 -50
- package/dist/index.d.mts +31 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +166 -94
- package/dist/index.mjs +239 -167
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -2,87 +2,97 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/JasonWeinzierl/eslint-plugin-rxjs-x/blob/master/LICENSE)
|
|
4
4
|
[](https://www.npmjs.com/package/eslint-plugin-rxjs-x)
|
|
5
|
+
[](https://scorecard.dev/viewer/?uri=github.com/JasonWeinzierl/eslint-plugin-rxjs-x)
|
|
5
6
|
|
|
6
7
|
This ESLint plugin is intended to prevent issues with [RxJS](https://github.com/ReactiveX/rxjs).
|
|
7
8
|
|
|
8
9
|
Most of these rules require TypeScript typed linting and are indicated as such below.
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
+
## Installation Guide (Flat Configuration)
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
but has since introduced new features which involve breaking changes.
|
|
13
|
+
See [typescript-eslint's Getting Started](https://typescript-eslint.io/getting-started) for a full ESLint setup guide.
|
|
14
14
|
|
|
15
|
-
1.
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
15
|
+
1. Install `eslint-plugin-rxjs-x` using your preferred package manager.
|
|
16
|
+
2. Enable typed linting.
|
|
17
|
+
- See [Linting with Type Information](https://typescript-eslint.io/getting-started/typed-linting/) for more information.
|
|
18
|
+
3. Import this plugin into your config.
|
|
19
|
+
Add the `rxjsX.configs.recommended` shared config to your configuration like so:
|
|
19
20
|
|
|
20
21
|
```diff
|
|
22
|
+
// @ts-check
|
|
23
|
+
import { defineConfig } from 'eslint/config';
|
|
24
|
+
import tseslint from 'typescript-eslint';
|
|
21
25
|
+ import rxjsX from 'eslint-plugin-rxjs-x';
|
|
26
|
+
|
|
27
|
+
export default defineConfig({
|
|
28
|
+
extends: [
|
|
29
|
+
tseslint.configs.recommended,
|
|
30
|
+
+ rxjsX.configs.recommended,
|
|
31
|
+
],
|
|
32
|
+
languageOptions: {
|
|
33
|
+
parserOptions: {
|
|
34
|
+
projectService: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
22
38
|
```
|
|
23
39
|
|
|
24
|
-
|
|
40
|
+
Additionally, consider if the `rxjsX.configs.strict` shared config is right for your project.
|
|
41
|
+
|
|
42
|
+
## Legacy Migration Guide from `eslint-plugin-rxjs`
|
|
43
|
+
|
|
44
|
+
> [!TIP]
|
|
45
|
+
> A complete description of all changes from `eslint-plugin-rxjs` are documented in the [CHANGELOG](CHANGELOG.md) file.
|
|
46
|
+
|
|
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`:
|
|
25
58
|
|
|
26
59
|
```diff
|
|
27
|
-
extends: [
|
|
28
|
-
|
|
60
|
+
"extends": [
|
|
61
|
+
"plugin:@typescript-eslint/recommended",
|
|
62
|
+
- "plugin:rxjs/recommended",
|
|
63
|
+
+ "plugin:rxjs-x/recommended-legacy",
|
|
29
64
|
],
|
|
30
65
|
```
|
|
31
66
|
|
|
32
|
-
|
|
33
|
-
|
|
67
|
+
3. If you previously did _not_ use a shared config,
|
|
68
|
+
then replace the `rxjs` plugin to your `plugins` block:
|
|
34
69
|
|
|
35
70
|
```diff
|
|
36
|
-
plugins:
|
|
37
|
-
|
|
38
|
-
|
|
71
|
+
"plugins": [
|
|
72
|
+
"@typescript-eslint",
|
|
73
|
+
- "rxjs",
|
|
74
|
+
+ "rxjs-x",
|
|
75
|
+
],
|
|
39
76
|
```
|
|
40
77
|
|
|
41
|
-
- Note: this is unnecessary if you are using
|
|
42
|
-
|
|
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:
|
|
43
80
|
|
|
44
81
|
```diff
|
|
45
|
-
|
|
46
|
-
|
|
82
|
+
"rules": {
|
|
83
|
+
- "rxjs/no-subject-value": "error",
|
|
84
|
+
+ "rxjs-x/no-subject-value": "error",
|
|
85
|
+
},
|
|
47
86
|
```
|
|
48
87
|
|
|
49
|
-
|
|
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.
|
|
50
90
|
|
|
51
91
|
```diff
|
|
52
92
|
- 'rxjs/no-ignored-observable': 'error',
|
|
53
93
|
+ 'rxjs-x/no-floating-observables': 'error',
|
|
54
94
|
```
|
|
55
95
|
|
|
56
|
-
> [!TIP]
|
|
57
|
-
> A complete description of all changes are documented in the [CHANGELOG](CHANGELOG.md) file.
|
|
58
|
-
|
|
59
|
-
## Installation Guide
|
|
60
|
-
|
|
61
|
-
See [typescript-eslint's Getting Started](https://typescript-eslint.io/getting-started) for a full ESLint setup guide.
|
|
62
|
-
|
|
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`.
|
|
66
|
-
|
|
67
|
-
```js
|
|
68
|
-
// @ts-check
|
|
69
|
-
import { defineConfig } from 'eslint/config';
|
|
70
|
-
import tseslint from 'typescript-eslint';
|
|
71
|
-
import rxjsX from 'eslint-plugin-rxjs-x';
|
|
72
|
-
|
|
73
|
-
export default defineConfig({
|
|
74
|
-
extends: [
|
|
75
|
-
...tseslint.configs.recommended,
|
|
76
|
-
rxjsX.configs.recommended,
|
|
77
|
-
],
|
|
78
|
-
languageOptions: {
|
|
79
|
-
parserOptions: {
|
|
80
|
-
projectService: true,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
```
|
|
85
|
-
|
|
86
96
|
## Configs
|
|
87
97
|
|
|
88
98
|
<!-- begin auto-generated configs list -->
|
|
@@ -127,6 +137,7 @@ The package includes the following rules.
|
|
|
127
137
|
| [no-ignored-default-value](docs/rules/no-ignored-default-value.md) | Disallow using `firstValueFrom`, `lastValueFrom`, `first`, and `last` without specifying a default value. | 🔒 | | | 💭 | |
|
|
128
138
|
| [no-ignored-error](docs/rules/no-ignored-error.md) | Disallow calling `subscribe` without specifying an error handler. | 🔒 | | | 💭 | |
|
|
129
139
|
| [no-ignored-notifier](docs/rules/no-ignored-notifier.md) | Disallow observables not composed from the `repeatWhen` or `retryWhen` notifier. | ✅ 🔒 | | | 💭 | |
|
|
140
|
+
| [no-ignored-observable](docs/rules/no-ignored-observable.md) | Disallow ignoring of observables returned by functions. | | | | | ❌ |
|
|
130
141
|
| [no-ignored-replay-buffer](docs/rules/no-ignored-replay-buffer.md) | Disallow using `ReplaySubject`, `publishReplay` or `shareReplay` without specifying the buffer size. | ✅ 🔒 | | | | |
|
|
131
142
|
| [no-ignored-subscribe](docs/rules/no-ignored-subscribe.md) | Disallow calling `subscribe` without specifying arguments. | | | | 💭 | |
|
|
132
143
|
| [no-ignored-subscription](docs/rules/no-ignored-subscription.md) | Disallow ignoring the subscription returned by `subscribe`. | | | | 💭 | |
|
package/dist/index.d.mts
CHANGED
|
@@ -18,12 +18,13 @@ declare const allRules: {
|
|
|
18
18
|
description: "Disallow banned operators.";
|
|
19
19
|
requiresTypeChecking: true;
|
|
20
20
|
}, TSESLint.RuleListener>;
|
|
21
|
-
finnish: TSESLint.RuleModule<"shouldBeFinnish" | "shouldNotBeFinnish", readonly {
|
|
21
|
+
finnish: TSESLint.RuleModule<"shouldBeFinnish" | "shouldBeFinnishProperty" | "shouldNotBeFinnish", readonly {
|
|
22
22
|
functions?: boolean;
|
|
23
23
|
methods?: boolean;
|
|
24
24
|
names?: Record<string, boolean>;
|
|
25
25
|
parameters?: boolean;
|
|
26
26
|
properties?: boolean;
|
|
27
|
+
objects?: boolean;
|
|
27
28
|
strict?: boolean;
|
|
28
29
|
types?: Record<string, boolean>;
|
|
29
30
|
variables?: boolean;
|
|
@@ -97,6 +98,9 @@ declare const allRules: {
|
|
|
97
98
|
recommended: "recommended";
|
|
98
99
|
requiresTypeChecking: true;
|
|
99
100
|
}, TSESLint.RuleListener>;
|
|
101
|
+
'no-ignored-observable': TSESLint.RuleModule<"forbidden", [], {
|
|
102
|
+
description: "Disallow ignoring of observables returned by functions.";
|
|
103
|
+
}, TSESLint.RuleListener>;
|
|
100
104
|
'no-ignored-replay-buffer': TSESLint.RuleModule<"forbidden", [], {
|
|
101
105
|
description: "Disallow using `ReplaySubject`, `publishReplay` or `shareReplay` without specifying the buffer size.";
|
|
102
106
|
recommended: "recommended";
|
|
@@ -116,7 +120,7 @@ declare const allRules: {
|
|
|
116
120
|
description: "Disallow ignoring the value within `takeWhile`.";
|
|
117
121
|
recommended: "recommended";
|
|
118
122
|
}, TSESLint.RuleListener>;
|
|
119
|
-
'no-implicit-any-catch': TSESLint.RuleModule<"explicitAny" | "implicitAny" | "narrowed" | "suggestExplicitUnknown", readonly {
|
|
123
|
+
'no-implicit-any-catch': TSESLint.RuleModule<"explicitAny" | "implicitAny" | "narrowed" | "suggestExplicitUnknown" | "suggestExplicitAny", readonly {
|
|
120
124
|
allowExplicitAny?: boolean;
|
|
121
125
|
}[], {
|
|
122
126
|
description: "Disallow implicit `any` error parameters in `catchError` operators.";
|
|
@@ -349,6 +353,31 @@ declare const rxjsX: {
|
|
|
349
353
|
}];
|
|
350
354
|
};
|
|
351
355
|
};
|
|
356
|
+
'recommended-legacy': {
|
|
357
|
+
plugins: ["rxjs-x"];
|
|
358
|
+
rules: {
|
|
359
|
+
'rxjs-x/no-async-subscribe': "error";
|
|
360
|
+
'rxjs-x/no-create': "error";
|
|
361
|
+
'rxjs-x/no-ignored-notifier': "error";
|
|
362
|
+
'rxjs-x/no-ignored-replay-buffer': "error";
|
|
363
|
+
'rxjs-x/no-ignored-takewhile-value': "error";
|
|
364
|
+
'rxjs-x/no-implicit-any-catch': "error";
|
|
365
|
+
'rxjs-x/no-index': "error";
|
|
366
|
+
'rxjs-x/no-internal': "error";
|
|
367
|
+
'rxjs-x/no-nested-subscribe': "error";
|
|
368
|
+
'rxjs-x/no-redundant-notify': "error";
|
|
369
|
+
'rxjs-x/no-sharereplay': "error";
|
|
370
|
+
'rxjs-x/no-subject-unsubscribe': "error";
|
|
371
|
+
'rxjs-x/no-subscribe-in-pipe': "error";
|
|
372
|
+
'rxjs-x/no-topromise': "error";
|
|
373
|
+
'rxjs-x/no-unbound-methods': "error";
|
|
374
|
+
'rxjs-x/no-unsafe-subject-next': "error";
|
|
375
|
+
'rxjs-x/no-unsafe-takeuntil': "error";
|
|
376
|
+
'rxjs-x/prefer-observer': "error";
|
|
377
|
+
'rxjs-x/prefer-root-operators': "error";
|
|
378
|
+
'rxjs-x/throw-error': "error";
|
|
379
|
+
};
|
|
380
|
+
};
|
|
352
381
|
};
|
|
353
382
|
meta: {
|
|
354
383
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,12 +18,13 @@ declare const allRules: {
|
|
|
18
18
|
description: "Disallow banned operators.";
|
|
19
19
|
requiresTypeChecking: true;
|
|
20
20
|
}, TSESLint.RuleListener>;
|
|
21
|
-
finnish: TSESLint.RuleModule<"shouldBeFinnish" | "shouldNotBeFinnish", readonly {
|
|
21
|
+
finnish: TSESLint.RuleModule<"shouldBeFinnish" | "shouldBeFinnishProperty" | "shouldNotBeFinnish", readonly {
|
|
22
22
|
functions?: boolean;
|
|
23
23
|
methods?: boolean;
|
|
24
24
|
names?: Record<string, boolean>;
|
|
25
25
|
parameters?: boolean;
|
|
26
26
|
properties?: boolean;
|
|
27
|
+
objects?: boolean;
|
|
27
28
|
strict?: boolean;
|
|
28
29
|
types?: Record<string, boolean>;
|
|
29
30
|
variables?: boolean;
|
|
@@ -97,6 +98,9 @@ declare const allRules: {
|
|
|
97
98
|
recommended: "recommended";
|
|
98
99
|
requiresTypeChecking: true;
|
|
99
100
|
}, TSESLint.RuleListener>;
|
|
101
|
+
'no-ignored-observable': TSESLint.RuleModule<"forbidden", [], {
|
|
102
|
+
description: "Disallow ignoring of observables returned by functions.";
|
|
103
|
+
}, TSESLint.RuleListener>;
|
|
100
104
|
'no-ignored-replay-buffer': TSESLint.RuleModule<"forbidden", [], {
|
|
101
105
|
description: "Disallow using `ReplaySubject`, `publishReplay` or `shareReplay` without specifying the buffer size.";
|
|
102
106
|
recommended: "recommended";
|
|
@@ -116,7 +120,7 @@ declare const allRules: {
|
|
|
116
120
|
description: "Disallow ignoring the value within `takeWhile`.";
|
|
117
121
|
recommended: "recommended";
|
|
118
122
|
}, TSESLint.RuleListener>;
|
|
119
|
-
'no-implicit-any-catch': TSESLint.RuleModule<"explicitAny" | "implicitAny" | "narrowed" | "suggestExplicitUnknown", readonly {
|
|
123
|
+
'no-implicit-any-catch': TSESLint.RuleModule<"explicitAny" | "implicitAny" | "narrowed" | "suggestExplicitUnknown" | "suggestExplicitAny", readonly {
|
|
120
124
|
allowExplicitAny?: boolean;
|
|
121
125
|
}[], {
|
|
122
126
|
description: "Disallow implicit `any` error parameters in `catchError` operators.";
|
|
@@ -349,6 +353,31 @@ declare const rxjsX: {
|
|
|
349
353
|
}];
|
|
350
354
|
};
|
|
351
355
|
};
|
|
356
|
+
'recommended-legacy': {
|
|
357
|
+
plugins: ["rxjs-x"];
|
|
358
|
+
rules: {
|
|
359
|
+
'rxjs-x/no-async-subscribe': "error";
|
|
360
|
+
'rxjs-x/no-create': "error";
|
|
361
|
+
'rxjs-x/no-ignored-notifier': "error";
|
|
362
|
+
'rxjs-x/no-ignored-replay-buffer': "error";
|
|
363
|
+
'rxjs-x/no-ignored-takewhile-value': "error";
|
|
364
|
+
'rxjs-x/no-implicit-any-catch': "error";
|
|
365
|
+
'rxjs-x/no-index': "error";
|
|
366
|
+
'rxjs-x/no-internal': "error";
|
|
367
|
+
'rxjs-x/no-nested-subscribe': "error";
|
|
368
|
+
'rxjs-x/no-redundant-notify': "error";
|
|
369
|
+
'rxjs-x/no-sharereplay': "error";
|
|
370
|
+
'rxjs-x/no-subject-unsubscribe': "error";
|
|
371
|
+
'rxjs-x/no-subscribe-in-pipe': "error";
|
|
372
|
+
'rxjs-x/no-topromise': "error";
|
|
373
|
+
'rxjs-x/no-unbound-methods': "error";
|
|
374
|
+
'rxjs-x/no-unsafe-subject-next': "error";
|
|
375
|
+
'rxjs-x/no-unsafe-takeuntil': "error";
|
|
376
|
+
'rxjs-x/prefer-observer': "error";
|
|
377
|
+
'rxjs-x/prefer-root-operators': "error";
|
|
378
|
+
'rxjs-x/throw-error': "error";
|
|
379
|
+
};
|
|
380
|
+
};
|
|
352
381
|
};
|
|
353
382
|
meta: {
|
|
354
383
|
name: string;
|