File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 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.
You can’t perform that action at this time.
0 commit comments