eslint-plugin-rxjs-angular-x

raw JSON →
1.0.1 verified Sat Apr 25 auth: no javascript

Fork of the unmaintained eslint-plugin-rxjs-angular to provide ESLint v10+ rules for combining RxJS 7 with Angular. Current stable v1.0.1 requires ESLint ^10.0.0, Node ^20.19.0 || ^22.13.0 || >=24, TypeScript >=4.8.4 <6.1.0, and is ESM-only (no CJS support). Ships TypeScript types. Includes three rules requiring type information: prefer-async-pipe, prefer-composition, prefer-takeuntil. Regular releases with breaking changes between majors.

error Error [ERR_REQUIRE_ESM]: require() of ES Module .../eslint-plugin-rxjs-angular-x/index.js from ... not supported.
cause Using CommonJS require() on v1.0.0+ which is ESM-only.
fix
Use ESM import syntax (import rxjsAngularX from 'eslint-plugin-rxjs-angular-x') or downgrade to v0.x.
error ESLint configuration error: Cannot find module 'eslint-plugin-rxjs-angular-x'
cause Plugin not installed, or ESM/CJS mismatch (e.g., flat config using CJS require).
fix
Run 'npm install eslint-plugin-rxjs-angular-x' and use ESM import in flat config.
error Failed to load parser 'typescript-eslint/parser' (or 'Error: @typescript-eslint/parser requires TypeScript >=4.8.4').
cause Missing or incompatible typescript peer dependency.
fix
Install typescript >=4.8.4 <6.1.0 as a dev dependency.
error Error: Rule 'rxjs-angular-x/prefer-async-pipe' requires type information.
cause Type information not configured (projectService or project missing).
fix
Add parserOptions.projectService: true (or project: './tsconfig.json') to your ESLint config.
error Cannot find module '@typescript-eslint/utils'
cause Missing dependency on @typescript-eslint/utils (peer of eslint-plugin-rxjs-angular-x).
fix
Install @typescript-eslint/utils ^8.56.0 (or let npm/pnpm handle peer deps).
breaking ESM-only since v1.0.0. CommonJS require fails.
fix Switch to ESM imports (import ... from 'eslint-plugin-rxjs-angular-x') or downgrade to v0.x.
breaking Requires ESLint v10 (was v9 in v0.x).
fix Upgrade ESLint to ^10.0.0.
breaking Node.js v18 no longer supported since v1.0.0.
fix Use Node.js ^20.19.0 || ^22.13.0 || >=24.
breaking rxjs peer dependency upper-bounded to ^7.2.0 in v0.1.2+. RxJS 8 is not supported.
fix Ensure rxjs version is ^7.2.0.
breaking TypeScript peer dependency upper-bounded to <6.1.0 in v1.0.1 (was <6.0.0 in v0.1.2).
fix Use TypeScript >=4.8.4 <6.1.0.
gotcha All rules require TypeScript type information (marked with 💭).
fix Configure languageOptions.parserOptions.projectService: true (or project: './tsconfig.json'). See typescript-eslint typed linting guide.
gotcha This plugin is a fork of the unmaintained eslint-plugin-rxjs-angular. Rules and options may differ slightly.
fix Review rule docs and migration guide in README if migrating from the original plugin.
npm install eslint-plugin-rxjs-angular-x
yarn add eslint-plugin-rxjs-angular-x
pnpm add eslint-plugin-rxjs-angular-x

Flat ESLint config using eslint-plugin-rxjs-angular-x with type-aware linting and two example rules.

// @ts-check
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';
import rxjsAngularX from 'eslint-plugin-rxjs-angular-x';

export default defineConfig({
  extends: [
    ...tseslint.configs.recommended,
  ],
  languageOptions: {
    parserOptions: {
      projectService: true,
    },
  },
  plugins: {
    'rxjs-angular-x': rxjsAngularX,
  },
  rules: {
    'rxjs-angular-x/prefer-async-pipe': 'error',
    'rxjs-angular-x/prefer-takeuntil': [
      'error',
      {
        checkComplete: true,
        checkDecorators: ['Component', 'Directive', 'Injectable'],
        alias: ['takeUntilDestroyed'],
        checkDestroy: false,
      },
    ],
  },
});