eslint-plugin-rxjs-x 0.2.4 → 0.3.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.
@@ -1,5 +1,7 @@
1
1
  # Disallow banned operators (`rxjs-x/ban-operators`)
2
2
 
3
+ 💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
4
+
3
5
  <!-- end auto-generated rule header -->
4
6
 
5
7
  This rule can be configured so that developers can ban any operators they want to avoid in their project.
@@ -0,0 +1,29 @@
1
+ # Disallow using `firstValueFrom`, `lastValueFrom`, `first`, and `last` without specifying a default value (`rxjs-x/no-ignored-default-value`)
2
+
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 `EmptyError` rejections if there were no emissions from `firstValueFrom`, `lastValueFrom`, `first`, or `last` by requiring `defaultValue`.
8
+
9
+ ## Rule details
10
+
11
+ Examples of **incorrect** code for this rule:
12
+
13
+ ```ts
14
+ import { Subject, firstValueFrom } from "rxjs";
15
+
16
+ const sub = new Subject();
17
+ const result = firstValueFrom(sub);
18
+ sub.complete();
19
+ ```
20
+
21
+ Examples of **correct** code for this rule:
22
+
23
+ ```ts
24
+ import { Subject, firstValueFrom } from "rxjs";
25
+
26
+ const sub = new Subject();
27
+ const result = firstValueFrom(sub, { defaultValue: null });
28
+ sub.complete();
29
+ ```
@@ -1,49 +1,38 @@
1
- # Enforce passing only `Error` values to error notifications (`rxjs-x/throw-error`)
1
+ # Enforce passing only `Error` values to `throwError` (`rxjs-x/throw-error`)
2
2
 
3
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 forbids throwing values that are neither `Error` nor `DOMException` instances.
7
+ This rule forbids passing values that are not `Error` objects to `throwError`.
8
+ It's similar to the typescript-eslint [`only-throw-error`](https://typescript-eslint.io/rules/only-throw-error/) rule,
9
+ but is for the `throwError` Observable creation function - not `throw` statements.
8
10
 
9
11
  ## Rule details
10
12
 
11
13
  Examples of **incorrect** code for this rule:
12
14
 
13
- ```ts
14
- throw "Kaboom!";
15
- ```
16
-
17
15
  ```ts
18
16
  import { throwError } from "rxjs";
19
- throwError("Kaboom!");
20
- ```
21
17
 
22
- ```ts
23
- import { throwError } from "rxjs";
24
18
  throwError(() => "Kaboom!");
25
19
  ```
26
20
 
27
21
  Examples of **correct** code for this rule:
28
22
 
29
23
  ```ts
30
- throw new Error("Kaboom!");
31
- ```
24
+ import { throwError } from "rxjs";
32
25
 
33
- ```ts
34
- throw new RangeError("Kaboom!");
26
+ throwError(() => new Error("Kaboom!"));
35
27
  ```
36
28
 
37
- ```ts
38
- throw new DOMException("Kaboom!");
39
- ```
29
+ ## Options
40
30
 
41
- ```ts
42
- import { throwError } from "rxjs";
43
- throwError(new Error("Kaboom!"));
44
- ```
31
+ <!-- begin auto-generated rule options list -->
45
32
 
46
- ```ts
47
- import { throwError } from "rxjs";
48
- throwError(() => new Error("Kaboom!"));
49
- ```
33
+ | Name | Description | Type | Default |
34
+ | :--------------------- | :---------------------------------------------------------- | :------ | :------ |
35
+ | `allowThrowingAny` | Whether to always allow throwing values typed as `any`. | Boolean | `true` |
36
+ | `allowThrowingUnknown` | Whether to always allow throwing values typed as `unknown`. | Boolean | `true` |
37
+
38
+ <!-- end auto-generated rule options list -->
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-rxjs-x",
3
3
  "type": "commonjs",
4
- "version": "0.2.4",
4
+ "version": "0.3.0",
5
5
  "packageManager": "yarn@4.5.1+sha512.341db9396b6e289fecc30cd7ab3af65060e05ebff4b3b47547b278b9e67b08f485ecd8c79006b405446262142c7a38154445ef7f17c1d5d1de7d90bf9ce7054d",
6
6
  "description": "ESLint v9+ plugin for RxJS",
7
7
  "author": "Jason Weinzierl <weinzierljason@gmail.com>",
@@ -75,25 +75,25 @@
75
75
  "@stylistic/eslint-plugin": "^2.10.1",
76
76
  "@types/common-tags": "^1.8.4",
77
77
  "@types/node": "~18.18.0",
78
- "@typescript-eslint/rule-tester": "^8.13.0",
78
+ "@typescript-eslint/rule-tester": "^8.14.0",
79
79
  "@typescript/vfs": "^1.6.0",
80
- "@vitest/coverage-v8": "^2.1.4",
81
- "@vitest/eslint-plugin": "^1.1.7",
82
- "bumpp": "^9.8.0",
80
+ "@vitest/coverage-v8": "^2.1.5",
81
+ "@vitest/eslint-plugin": "^1.1.10",
82
+ "bumpp": "^9.8.1",
83
83
  "eslint": "^9.14.0",
84
84
  "eslint-config-flat-gitignore": "^0.3.0",
85
85
  "eslint-doc-generator": "^1.7.1",
86
86
  "eslint-import-resolver-typescript": "^3.6.3",
87
87
  "eslint-plugin-eslint-plugin": "^6.3.1",
88
- "eslint-plugin-import-x": "^4.4.0",
88
+ "eslint-plugin-import-x": "^4.4.2",
89
89
  "eslint-plugin-n": "^17.13.1",
90
- "markdownlint-cli2": "^0.14.0",
90
+ "markdownlint-cli2": "^0.15.0",
91
91
  "rxjs": "^7.8.1",
92
92
  "tsup": "^8.3.5",
93
93
  "tsx": "^4.19.2",
94
94
  "typescript": "~5.6.3",
95
- "typescript-eslint": "^8.13.0",
96
- "vitest": "^2.1.4"
95
+ "typescript-eslint": "^8.14.0",
96
+ "vitest": "^2.1.5"
97
97
  },
98
98
  "engines": {
99
99
  "node": "^18.18.0 || ^20.9.0 || >= 21.1.0"