@@ -5,7 +5,7 @@ import { ruleTester } from '../rule-tester';
55
66const setup = stripIndent `
77 import { Observable, of } from "rxjs";
8- import { mapTo } from "rxjs/operators";
8+ import { map } from "rxjs/operators";
99
1010 type Action<T extends string> = { type: T };
1111 type ActionOfType<T> = T extends string ? Action<T> : never;
@@ -27,20 +27,20 @@ ruleTester({ types: true }).run('no-cyclic-action', noCyclicActionRule, {
2727 code : stripIndent `
2828 // effect SOMETHING to SOMETHING_ELSE
2929 ${ 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));
3434 ` ,
3535 } ,
3636 {
3737 code : stripIndent `
3838 // epic SOMETHING to SOMETHING_ELSE
3939 ${ 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));
4444 ` ,
4545 } ,
4646 {
@@ -56,55 +56,55 @@ ruleTester({ types: true }).run('no-cyclic-action', noCyclicActionRule, {
5656 stripIndent `
5757 // effect SOMETHING to SOMETHING
5858 ${ 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 }) ));
6060 ~~~~~~~~~~~~ [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));
6262 ~~~~~~~~~~~~ [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 }) ));
6464 ~~~~~~~~~~~~ [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));
6666 ~~~~~~~~~~~~ [forbidden]
6767 ` ,
6868 ) ,
6969 fromFixture (
7070 stripIndent `
7171 // epic SOMETHING to SOMETHING
7272 ${ 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 }) ));
7474 ~~~~~~~~~~~~ [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));
7676 ~~~~~~~~~~~~ [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 }) ));
7878 ~~~~~~~~~~~~ [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));
8080 ~~~~~~~~~~~~ [forbidden]
8181 ` ,
8282 ) ,
8383 fromFixture (
8484 stripIndent `
8585 // effect SOMETHING | SOMETHING_ELSE to SOMETHING
8686 ${ 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 }) ));
8888 ~~~~~~~~~~~~ [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));
9090 ~~~~~~~~~~~~ [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 }) ));
9292 ~~~~~~~~~~~~ [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));
9494 ~~~~~~~~~~~~ [forbidden]
9595 ` ,
9696 ) ,
9797 fromFixture (
9898 stripIndent `
9999 // epic SOMETHING | SOMETHING_ELSE to SOMETHING
100100 ${ 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 }) ));
102102 ~~~~~~~~~~~~ [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));
104104 ~~~~~~~~~~~~ [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 }) ));
106106 ~~~~~~~~~~~~ [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));
108108 ~~~~~~~~~~~~ [forbidden]
109109 ` ,
110110 ) ,
0 commit comments