Skip to content

Conversation

@jsaguet
Copy link
Contributor

@jsaguet jsaguet commented Jul 4, 2024

…tions-in-effects

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Eslint rules incorrectly reports an error for the rule no-multiple-actions-in-effects for the following code:

import { Actions, createEffect, ofType } from '@ngrx/effects';
import { createAction, props } from '@ngrx/store';
import { of, switchMap } from 'rxjs';

const foo = createAction('foo', props<{ payload: string }>());
const bar = createAction('bar');
const baz = createAction('baz');

@Injectable()
export class Effects {
  constructor(private actions$: Actions) {}
  effect$ = createEffect(() =>
      this.actions$.pipe(
          ofType(foo),
          switchMap(({ payload }: { payload: string }) => (payload === 'value' ? of(bar()) : of(baz()))),
      ),
  );
}

Closes #

What is the new behavior?

The eslint rule does not report an error on the valid code.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@jsaguet jsaguet changed the title fix(eslint-plugin): do not report non-array returns in no-multiple-ac… fix(eslint-plugin): do not report non-array returns in no-multiple-actions-in-effects Jul 4, 2024
@netlify
Copy link

netlify bot commented Jul 4, 2024

Deploy Preview for ngrx-io canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 1d6069f
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/6686b7c00674b200081b438e

@markostanimirovic markostanimirovic merged commit 92a68bc into ngrx:main Jul 9, 2024
@markostanimirovic
Copy link
Member

Thank you @jsaguet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants