Skip to content

Commit 3917fa5

Browse files
docs(no-unsafe-subject-next): when not to use it
1 parent ca7ad27 commit 3917fa5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

docs/rules/no-unsafe-subject-next.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
This rule effects failures if `next` is called without an argument and the subject's value type is not `void`.
1010

11-
In RxJS version 6, the `next` method's `value` parameter is optional, but a value should always be specified for subjects with non-`void` element types.
11+
In RxJS version 6, the `next` method's `value` parameter was optional, but a value should always be specified for subjects with non-`void` element types.
12+
RxJS version 7 changed the `value` parameter to mandatory.
1213

1314
## Rule details
1415

@@ -30,3 +31,16 @@ subject.next();
3031
const subject = new Subject<number>();
3132
subject.next(0);
3233
```
34+
35+
## When Not To Use It
36+
37+
If you don't care about sending `undefined` to subjects, then you don't need this rule.
38+
Alternatively, you may rely on TypeScript to enforce the `value` parameter,
39+
which was made mandatory in RxJS version 7.
40+
41+
Type checked lint rules are more powerful than traditional lint rules, but also require configuring type checked linting.
42+
43+
## Resources
44+
45+
- [Rule source](https://github.com/JasonWeinzierl/eslint-plugin-rxjs-x/blob/main/src/rules/no-unsafe-subject-next.ts)
46+
- [Test source](https://github.com/JasonWeinzierl/eslint-plugin-rxjs-x/blob/main/tests/rules/no-unsafe-subject-next.test.ts)

0 commit comments

Comments
 (0)