Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint-plugin(component-store): avoid-mapping-selectors #3940

Closed
1 of 2 tasks
LayZeeDK opened this issue Jul 4, 2023 · 0 comments · Fixed by #4026
Closed
1 of 2 tasks

eslint-plugin(component-store): avoid-mapping-selectors #3940

LayZeeDK opened this issue Jul 4, 2023 · 0 comments · Fixed by #4026

Comments

@LayZeeDK
Copy link
Contributor

LayZeeDK commented Jul 4, 2023

Which @ngrx/* package(s) are relevant/related to the feature request?

component-store, eslint-plugin

Information

I think an NgRx ComponentStore variant of the NgRx Store ESLint rule avoid-mapping-selectors would be helpful to avoid anti-patterns.

Incorrect usage

export class UserStore extends ComponentStore<UserState> {
  loggedInUser$ = this.select((state) => state.loggedInUser);

  name$ = this.select(this.loggedInUser$).pipe(map((user) => user.name));
}

Correct usage

export class UserStore extends ComponentStore<UserState> {
  loggedInUser$ = this.select((state) => state.loggedInUser);

  name$ = this.select(this.loggedInUser$, (user) => user.name);
}

Describe any alternatives/workarounds you're currently using

Currently, I'm maintaining internal developer guides for NgRx ComponentStore usage.

I would be willing to submit a PR to fix this issue

  • Yes
  • No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants