Skip to content

Commit 20cbcfa

Browse files
docs(no-nested-subscribe): when not to use it
1 parent 22fa1b8 commit 20cbcfa

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/rules/no-nested-subscribe.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,17 @@ of(42, 54).pipe(
3030
mergeMap((value) => timer(1e3).pipe(map(() => value)))
3131
).subscribe((value) => console.log(value));
3232
```
33+
34+
## When Not To Use It
35+
36+
If you need nested subscriptions and are aware of the potential issues,
37+
then you might not need this rule.
38+
However, you should typically prefer to use higher-order mapping operators
39+
like `mergeMap`, `switchMap`, or `concatMap` to handle nested observables.
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-nested-subscribe.ts)
46+
- [Test source](https://github.com/JasonWeinzierl/eslint-plugin-rxjs-x/blob/main/tests/rules/no-nested-subscribe.test.ts)

0 commit comments

Comments
 (0)