You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which @ngrx/* package(s) are the source of the bug?
eslint-plugin
Minimal reproduction of the bug/regression with instructions
constcondition=true;constfoo=()=>({type: 'foo'})asconst,bar=()=>({type: 'bar'})asconst;createEffect(// False positive - single action, reported as multiple()=>inject(Actions).pipe(switchMap(()=>(condition ? of(foo()) : of(bar())))),{functional: true},);createEffect(// False negative - two arrays of actions, not reported()=>inject(Actions).pipe(switchMap(()=>(condition ? [foo(),foo()] : [bar(),bar()]))),{functional: true},);
Expected behavior
In the first effect, conditional expression returns one of two actions - the type is a union. Only one action actually gets emitted, so it should not be flagged
The second effect returns one of two arrays of multiple actions, so it should be reported as a problem by the rule.
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)
The case for unions seems to be checking whether one of the types is not an array, when it should be doing the opposite? Hence the observed behavior - union with zero array types is flagged but union of only arrays is not.
I would be willing to submit a PR to fix this issue
Yes
No
The text was updated successfully, but these errors were encountered:
Which @ngrx/* package(s) are the source of the bug?
eslint-plugin
Minimal reproduction of the bug/regression with instructions
Expected behavior
In the first effect, conditional expression returns one of two actions - the type is a union. Only one action actually gets emitted, so it should not be flagged
The second effect returns one of two arrays of multiple actions, so it should be reported as a problem by the rule.
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)
NgRx: 18.0.1
Angular: 18.0.6
Node: 18.20.2
Other information
Possibly caused by
platform/modules/eslint-plugin/src/rules/effects/no-multiple-actions-in-effects.ts
Lines 59 to 63 in 377f3b8
The case for unions seems to be checking whether one of the types is not an array, when it should be doing the opposite? Hence the observed behavior - union with zero array types is flagged but union of only arrays is not.
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: