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 should use correct version of 'concatLatestFrom' in autofix for rule 'prefer-concat-latest-from' #4299

Open
2 tasks
robinsierra-ergon opened this issue Apr 16, 2024 · 5 comments

Comments

@robinsierra-ergon
Copy link

Which @ngrx/* package(s) are the source of the bug?

eslint-plugin

Minimal reproduction of the bug/regression with instructions

The rule 'prefer-concat-latest-from' has an autofix that fixes

withLatestFrom(store.select(...))

to

concatLatestFrom(() => store.select(...))

however, it uses the deprecated import form @ngrx/effects instead of @ngrx/operators.

Expected behavior

The function from @ngrx/operators should be used.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

NgRx 17.2.0

Other information

No response

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

  • Yes
  • No
@tom9744
Copy link
Contributor

tom9744 commented Apr 23, 2024

Hi, I'm interested in fixing this issue. Could I work on it?

@brandonroberts
Copy link
Member

@tom9744 Sure

@timdeschryver
Copy link
Member

Just for a sanity check, updating the import reference from effects to operators won't break a project if it uses the fix feature, right? Because operators is a dependency from effects we can safely update the import statement.

@timdeschryver
Copy link
Member

Just for a sanity check, updating the import reference from effects to operators won't break a project if it uses the fix feature, right? Because operators is a dependency from effects we can safely update the import statement.

This seems to work just fine 👍

@tom9744
Copy link
Contributor

tom9744 commented Apr 28, 2024

When I look at the prefer-concat-latest-from.ts file, it seems like the rule still belongs to the @ngrx/effect module. Even though the concat-latest-from operator has been moved to the @ngrx/operators module.

export default createRule<Options, MessageIds>({
  name: path.parse(__filename).name,
  meta: {
    type: 'problem',
    ngrxModule: 'effects',
    version: '>=12.0.0',
    ...

So, I wonder if I should append the operators: '@ngrx/operators' property to the NGRX_MODULE_PATHS object which is declared in the ngrx-modules.ts file?

export const NGRX_MODULE_PATHS = {
  ['component-store']: '@ngrx/component-store',
  effects: '@ngrx/effects',
  operators: '@ngrx/operators', // 👈 Here!
  store: '@ngrx/store',
} as const;

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

No branches or pull requests

4 participants