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

Add rule enforcing operator imports from "rxjs" instead of "rxjs/operators" #9

Closed
JasonWeinzierl opened this issue Nov 6, 2024 · 1 comment · Fixed by #34
Closed
Labels
enhancement New feature or request
Milestone

Comments

@JasonWeinzierl
Copy link
Owner

JasonWeinzierl commented Nov 6, 2024

Since RxJS v7.2.0, operators should be imported from "rxjs" instead of "rxjs/operators": https://rxjs.dev/guide/importing. We should add a rule for enforcing this.

Related: #7 , ReactiveX/rxjs#6488, cartant#108, cartant#121

@JasonWeinzierl JasonWeinzierl added this to the v1 milestone Nov 6, 2024
@JasonWeinzierl JasonWeinzierl added the enhancement New feature or request label Nov 6, 2024
@rob4226
Copy link

rob4226 commented Nov 14, 2024

I've been using the below rule I configured myself but it would definitely be nice to have a rule included with this plugin.

'@typescript-eslint/no-restricted-imports': [
  'error',
  {
    paths: [
      {
        name: 'rxjs/Rx',
        message: 'rxjs/Rx is no longer a valid import site. This is very old import path for RxJS, use `from rxjs`.',
      },
      {
        name: 'rxjs/operators',
        message: "With RxJS v7.2.0, most operators have been moved to 'rxjs' export site. This means that the preferred way to import operators is from 'rxjs', while 'rxjs/operators' export site has been deprecated. https://rxjs.dev/guide/importing#new-in-rxjs-v720",
      },
],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants