eslint-plugin-rxjs

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

ESLint plugin providing a comprehensive set of rules for RxJS (v5, 2024). It reimplements the rules from rxjs-tslint-rules for ESLint, covering common mistakes like async subscribe, ignored observables, nested subscribes, and more. Almost all rules require @typescript-eslint/parser and a TypeScript project. The package includes a recommended configuration with opinionated rules separate. Release cadence is stable with frequent updates. Compared to alternatives like eslint-plugin-rxjs-angular (Angular-specific), this plugin covers generic RxJS patterns across frameworks.

error Error: Cannot find module 'eslint-plugin-rxjs'
cause Package not installed
fix
Run 'npm install eslint-plugin-rxjs --save-dev'
error Error: Parsing error: 'parser' is not set
cause Missing @typescript-eslint/parser configuration
fix
Set parser: '@typescript-eslint/parser' in ESLint config and install the package.
error Error: Rule 'rxjs/no-async-subscribe' requires type information
cause parserOptions.project not set or missing tsconfig
fix
Add parserOptions.project pointing to your tsconfig.json
breaking Breaking: v5 removed support for ESLint <8 and changed some rule names
fix Upgrade eslint to ^8.0.0 and check rule names; see migration guide.
gotcha Most rules require TypeScript parser and 'project' option for type checking
fix Ensure @typescript-eslint/parser is installed and parserOptions.project points to tsconfig.json.
deprecated Rules like 'rxjs/no-operator' and 'rxjs/no-wholesale' removed in v5
fix Replace with equivalent rules or disable.
npm install eslint-plugin-rxjs
yarn add eslint-plugin-rxjs
pnpm add eslint-plugin-rxjs

Setup ESLint with rxjs plugin, using @typescript-eslint/parser and recommended config.

// In .eslintrc.js
const { join } = require('path');
module.exports = {
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaVersion: 2019,
    project: join(__dirname, './tsconfig.json'),
    sourceType: 'module',
  },
  plugins: ['rxjs'],
  extends: ['plugin:rxjs/recommended'],
  rules: {
    'rxjs/no-async-subscribe': 'error',
    'rxjs/no-ignored-observable': 'error',
    'rxjs/no-ignored-subscription': 'error',
    'rxjs/no-nested-subscribe': 'error',
  },
};