false positive for rule @ngrx/no-multiple-actions-in-effects
FabienDehopre opened this issue · comments
Fabien Dehopré commented
Which @ngrx/* package(s) are the source of the bug?
eslint-plugin
Minimal reproduction of the bug/regression with instructions
export const saveSearchCriteria$ = createEffect(
(actions$ = inject(Actions$), store = inject(Store), saveLoadService = inject(SaveLoadService)) => {
return actions$.pipe(
ofType(SearchCriteriaActions.save),
concatLatestFrom(() => store.select(inventoryFeature.selectInventoryItems)),
concatMap(([{ searchCriteriaName }, inventoryItems]) => {
const tags = Object.keys(inventoryItems)
.filter((inventoryType) => {
const [, inventorySearchType] = splitInventoryType(inventoryType as InventoryType);
// eslint-disable-next-line @ngrx/no-multiple-actions-in-effects -- false positive
return inventorySearchType === 'costCenter' || inventorySearchType === 'wbs';
})
.map((inventoryType) => splitInventoryType(inventoryType as InventoryType))
.map(([value, type]) => ({ value, type }));
return saveLoadService.saveSearch(searchCriteriaName, tags, false).pipe(
map(() => SearchCriteriaActions.saveSucceeded()),
catchError((error: Error) => {
if (error instanceof HttpErrorResponse && error.status === 409) {
return of(SearchCriteriaActions.saveAlreadyExists({ searchCriteriaName, tags }));
}
return defaultErrorHadnler(error, 'inventoryDomain.messages.saveSearchFailed', SearchCriteriaActions.saveFailed());
})
);
})
);
},
{ functional: true }
);
Expected behavior
the line under the // eslint-disable-next-line @ngrx/no-multiple-actions-in-effects -- false positive
should not trigger the no-multiple-actions-in-effects
rule.
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)
NgRx: 18.0.0
Angular: 18.0.4
Node: 20.14.0
Other information
No response
I would be willing to submit a PR to fix this issue
- Yes
- No
Fabien Dehopré commented
The code is coming from a private Azure DevOps repo. I can try to provide a public github repo if you really require it.
Tim Deschryver commented
Thanks for the reproduction @FabienDehopre , it helped to fix this issue. 👍