Skip to content

Commit 7448e49

Browse files
committed
chore: Add docs and readme link
1 parent 6cc1d61 commit 7448e49

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

docs/rules/no-subscribe-in-pipe.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Avoid `subscribe` calls inside `pipe` operators (`no-subscribe-in-pipe`)
2+
3+
This rule effects failures if `subscribe` is called within any operator inside a `pipe` operation.
4+
5+
## Rule details
6+
7+
Examples of **incorrect** code for this rule:
8+
9+
```ts
10+
import { of } from "rxjs";
11+
import { map } from "rxjs/operators";
12+
13+
of(42, 54).pipe(
14+
map(value => {
15+
of(value).subscribe(console.log); // This will trigger the rule
16+
return value * 2;
17+
})
18+
).subscribe(result => console.log(result));
19+
```
20+
21+
Examples of **correct** code for this rule:
22+
23+
```ts
24+
import { of } from "rxjs";
25+
import { map, tap } from "rxjs/operators";
26+
27+
of(42, 54).pipe(
28+
tap(value => console.log(value)),
29+
map(value => value * 2)
30+
).subscribe(result => console.log(result));
31+
```
32+
33+
## Options
34+
35+
This rule has no options.

0 commit comments

Comments
 (0)