@@ -5,7 +5,7 @@ import { ruleTester } from '../rule-tester';
5
5
6
6
const setup = stripIndent `
7
7
import { Observable, of } from "rxjs";
8
- import { mapTo } from "rxjs/operators";
8
+ import { map } from "rxjs/operators";
9
9
10
10
type Action<T extends string> = { type: T };
11
11
type ActionOfType<T> = T extends string ? Action<T> : never;
@@ -27,20 +27,20 @@ ruleTester({ types: true }).run('no-cyclic-action', noCyclicActionRule, {
27
27
code : stripIndent `
28
28
// effect SOMETHING to SOMETHING_ELSE
29
29
${ setup }
30
- const a = actions.pipe(ofType("SOMETHING"), mapTo( { type: "SOMETHING_ELSE" as const }));
31
- const b = actions.pipe(ofType("SOMETHING"), mapTo( { type: SOMETHING_ELSE } as const));
32
- const c = actions.pipe(ofType(SOMETHING), mapTo( { type: "SOMETHING_ELSE" as const }));
33
- const d = actions.pipe(ofType(SOMETHING), mapTo( { type: SOMETHING_ELSE } as const));
30
+ const a = actions.pipe(ofType("SOMETHING"), map(() => ( { type: "SOMETHING_ELSE" as const }) ));
31
+ const b = actions.pipe(ofType("SOMETHING"), map(() => ( { type: SOMETHING_ELSE }) as const));
32
+ const c = actions.pipe(ofType(SOMETHING), map(() => ( { type: "SOMETHING_ELSE" as const }) ));
33
+ const d = actions.pipe(ofType(SOMETHING), map(() => ( { type: SOMETHING_ELSE }) as const));
34
34
` ,
35
35
} ,
36
36
{
37
37
code : stripIndent `
38
38
// epic SOMETHING to SOMETHING_ELSE
39
39
${ setup }
40
- const a = (action$: Actions) => action$.pipe(ofType("SOMETHING"), mapTo( { type: "SOMETHING_ELSE" as const }));
41
- const b = (action$: Actions) => action$.pipe(ofType("SOMETHING"), mapTo( { type: SOMETHING_ELSE } as const));
42
- const c = (action$: Actions) => action$.pipe(ofType(SOMETHING), mapTo( { type: "SOMETHING_ELSE" as const }));
43
- const d = (action$: Actions) => action$.pipe(ofType(SOMETHING), mapTo( { type: SOMETHING_ELSE } as const));
40
+ const a = (action$: Actions) => action$.pipe(ofType("SOMETHING"), map(() => ( { type: "SOMETHING_ELSE" as const }) ));
41
+ const b = (action$: Actions) => action$.pipe(ofType("SOMETHING"), map(() => ( { type: SOMETHING_ELSE }) as const));
42
+ const c = (action$: Actions) => action$.pipe(ofType(SOMETHING), map(() => ( { type: "SOMETHING_ELSE" as const }) ));
43
+ const d = (action$: Actions) => action$.pipe(ofType(SOMETHING), map(() => ( { type: SOMETHING_ELSE }) as const));
44
44
` ,
45
45
} ,
46
46
{
@@ -56,55 +56,55 @@ ruleTester({ types: true }).run('no-cyclic-action', noCyclicActionRule, {
56
56
stripIndent `
57
57
// effect SOMETHING to SOMETHING
58
58
${ setup }
59
- const a = actions.pipe(ofType("SOMETHING"), mapTo( { type: "SOMETHING" as const }));
59
+ const a = actions.pipe(ofType("SOMETHING"), map(() => ( { type: "SOMETHING" as const }) ));
60
60
~~~~~~~~~~~~ [forbidden]
61
- const b = actions.pipe(ofType("SOMETHING"), mapTo( { type: SOMETHING } as const));
61
+ const b = actions.pipe(ofType("SOMETHING"), map(() => ( { type: SOMETHING }) as const));
62
62
~~~~~~~~~~~~ [forbidden]
63
- const c = actions.pipe(ofType(SOMETHING), mapTo( { type: "SOMETHING" as const }));
63
+ const c = actions.pipe(ofType(SOMETHING), map(() => ( { type: "SOMETHING" as const }) ));
64
64
~~~~~~~~~~~~ [forbidden]
65
- const d = actions.pipe(ofType(SOMETHING), mapTo( { type: SOMETHING } as const));
65
+ const d = actions.pipe(ofType(SOMETHING), map(() => ( { type: SOMETHING }) as const));
66
66
~~~~~~~~~~~~ [forbidden]
67
67
` ,
68
68
) ,
69
69
fromFixture (
70
70
stripIndent `
71
71
// epic SOMETHING to SOMETHING
72
72
${ setup }
73
- const a = (action$: Actions) => action$.pipe(ofType("SOMETHING"), mapTo( { type: "SOMETHING" as const }));
73
+ const a = (action$: Actions) => action$.pipe(ofType("SOMETHING"), map(() => ( { type: "SOMETHING" as const }) ));
74
74
~~~~~~~~~~~~ [forbidden]
75
- const b = (action$: Actions) => action$.pipe(ofType("SOMETHING"), mapTo( { type: SOMETHING } as const));
75
+ const b = (action$: Actions) => action$.pipe(ofType("SOMETHING"), map(() => ( { type: SOMETHING }) as const));
76
76
~~~~~~~~~~~~ [forbidden]
77
- const c = (action$: Actions) => action$.pipe(ofType(SOMETHING), mapTo( { type: "SOMETHING" as const }));
77
+ const c = (action$: Actions) => action$.pipe(ofType(SOMETHING), map(() => ( { type: "SOMETHING" as const }) ));
78
78
~~~~~~~~~~~~ [forbidden]
79
- const d = (action$: Actions) => action$.pipe(ofType(SOMETHING), mapTo( { type: SOMETHING } as const));
79
+ const d = (action$: Actions) => action$.pipe(ofType(SOMETHING), map(() => ( { type: SOMETHING }) as const));
80
80
~~~~~~~~~~~~ [forbidden]
81
81
` ,
82
82
) ,
83
83
fromFixture (
84
84
stripIndent `
85
85
// effect SOMETHING | SOMETHING_ELSE to SOMETHING
86
86
${ setup }
87
- const a = actions.pipe(ofType("SOMETHING", "SOMETHING_ELSE"), mapTo( { type: "SOMETHING" as const }));
87
+ const a = actions.pipe(ofType("SOMETHING", "SOMETHING_ELSE"), map(() => ( { type: "SOMETHING" as const }) ));
88
88
~~~~~~~~~~~~ [forbidden]
89
- const b = actions.pipe(ofType("SOMETHING", "SOMETHING_ELSE"), mapTo( { type: SOMETHING } as const));
89
+ const b = actions.pipe(ofType("SOMETHING", "SOMETHING_ELSE"), map(() => ( { type: SOMETHING }) as const));
90
90
~~~~~~~~~~~~ [forbidden]
91
- const c = actions.pipe(ofType(SOMETHING, SOMETHING_ELSE), mapTo( { type: "SOMETHING" as const }));
91
+ const c = actions.pipe(ofType(SOMETHING, SOMETHING_ELSE), map(() => ( { type: "SOMETHING" as const }) ));
92
92
~~~~~~~~~~~~ [forbidden]
93
- const d = actions.pipe(ofType(SOMETHING, SOMETHING_ELSE), mapTo( { type: SOMETHING } as const));
93
+ const d = actions.pipe(ofType(SOMETHING, SOMETHING_ELSE), map(() => ( { type: SOMETHING }) as const));
94
94
~~~~~~~~~~~~ [forbidden]
95
95
` ,
96
96
) ,
97
97
fromFixture (
98
98
stripIndent `
99
99
// epic SOMETHING | SOMETHING_ELSE to SOMETHING
100
100
${ setup }
101
- const a = (action$: Actions) => action$.pipe(ofType("SOMETHING", "SOMETHING_ELSE"), mapTo( { type: "SOMETHING" as const }));
101
+ const a = (action$: Actions) => action$.pipe(ofType("SOMETHING", "SOMETHING_ELSE"), map(() => ( { type: "SOMETHING" as const }) ));
102
102
~~~~~~~~~~~~ [forbidden]
103
- const b = (action$: Actions) => action$.pipe(ofType("SOMETHING", "SOMETHING_ELSE"), mapTo( { type: SOMETHING } as const));
103
+ const b = (action$: Actions) => action$.pipe(ofType("SOMETHING", "SOMETHING_ELSE"), map(() => ( { type: SOMETHING }) as const));
104
104
~~~~~~~~~~~~ [forbidden]
105
- const c = (action$: Actions) => action$.pipe(ofType(SOMETHING, SOMETHING_ELSE), mapTo( { type: "SOMETHING" as const }));
105
+ const c = (action$: Actions) => action$.pipe(ofType(SOMETHING, SOMETHING_ELSE), map(() => ( { type: "SOMETHING" as const }) ));
106
106
~~~~~~~~~~~~ [forbidden]
107
- const d = (action$: Actions) => action$.pipe(ofType(SOMETHING, SOMETHING_ELSE), mapTo( { type: SOMETHING } as const));
107
+ const d = (action$: Actions) => action$.pipe(ofType(SOMETHING, SOMETHING_ELSE), map(() => ( { type: SOMETHING }) as const));
108
108
~~~~~~~~~~~~ [forbidden]
109
109
` ,
110
110
) ,
0 commit comments