eslint-plugin-rxjs-x

May 21, 2026 Β· View on GitHub

GitHub License NPM version OpenSSF Scorecard OpenSSF Best Practices

Note

Forked from eslint-plugin-rxjs as the original repository seems no longer maintained.

This ESLint plugin is intended to prevent issues with RxJS 7.

Most of these rules require TypeScript typed linting and are indicated as such below.

Installation Guide (Flat Configuration)

See typescript-eslint's Getting Started for a full ESLint setup guide.

  1. Install eslint-plugin-rxjs-x using your preferred package manager.

  2. Enable typed linting.

  3. Import this plugin into your config. Add the rxjsX.configs.recommended shared config to your configuration like so:

    // @ts-check
    import { defineConfig } from 'eslint/config';
    import tseslint from 'typescript-eslint';
    + import rxjsX from 'eslint-plugin-rxjs-x';
    
    export default defineConfig({
        extends: [
            tseslint.configs.recommended,
    +       rxjsX.configs.recommended,
        ],
        languageOptions: {
            parserOptions: {
                projectService: true,
            },
        },
    });
    

Additionally, consider if the rxjsX.configs.strict shared config is right for your project.

Notable Changes from eslint-plugin-rxjs

  1. eslintrc is not supported.
  2. The namespace of this plugin is rxjs-x instead of rxjs.
    • e.g. if your ESLint config had "rxjs/no-subject-value": "error", replace it with "rxjs-x/no-subject-value": "error".
    • e.g. if your project had inline comments like // eslint-disable-next-line rxjs/no-async-subscribe, replace them with // eslint-disable-next-line rxjs-x/no-async-subscribe.
  3. rxjs/no-ignored-observable is replaced with rxjs-x/no-floating-observables.

Tip

A complete description of all changes from eslint-plugin-rxjs are documented in the CHANGELOG file.

Configs

Name
βœ…recommended
πŸ”’strict

Rules

The package includes the following rules.

πŸ’Ό Configurations enabled in.
βœ… Set in the recommended configuration.
πŸ”’ Set in the strict configuration.
πŸ”§ Automatically fixable by the --fix CLI option.
πŸ’‘ Manually fixable by editor suggestions.
πŸ’­ Requires type information.

NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β DescriptionπŸ’ΌπŸ”§πŸ’‘πŸ’­
ban-observablesDisallow banned observable creators.
ban-operatorsDisallow banned operators.πŸ’­
finnishEnforce Finnish notation.πŸ’­
justRequire the use of just instead of of.πŸ”§
no-async-subscribeDisallow passing async functions to subscribe.βœ… πŸ”’πŸ’­
no-connectableDisallow operators that return connectable observables.πŸ’­
no-createDisallow the static Observable.create and Subject.create functions.βœ… πŸ”’πŸ’­
no-cyclic-actionDisallow cyclic actions in effects and epics.πŸ’­
no-explicit-genericsDisallow unnecessary explicit generic type arguments.πŸ’­
no-exposed-subjectsDisallow public and protected subjects.πŸ”’πŸ’­
no-finnishDisallow Finnish notation.πŸ’­
no-floating-observablesRequire Observables to be handled appropriately.πŸ”’πŸ’­
no-ignored-default-valueDisallow using firstValueFrom, lastValueFrom, first, and last without specifying a default value.πŸ”’πŸ’­
no-ignored-errorDisallow calling subscribe without specifying an error handler.πŸ”’πŸ’­
no-ignored-notifierDisallow observables not composed from the repeatWhen or retryWhen notifier.βœ… πŸ”’πŸ’­
no-ignored-replay-bufferDisallow using ReplaySubject, publishReplay or shareReplay without specifying the buffer size.βœ… πŸ”’
no-ignored-subscribeDisallow calling subscribe without specifying arguments.πŸ’­
no-ignored-subscriptionDisallow ignoring the subscription returned by subscribe.πŸ’­
no-ignored-takewhile-valueDisallow ignoring the value within takeWhile.βœ… πŸ”’
no-implicit-any-catchDisallow implicit any error parameters in catchError, subscribe, and tap.βœ… πŸ”’πŸ”§πŸ’‘πŸ’­
no-indexDisallow importing index modules.βœ… πŸ”’
no-internalDisallow importing internal modules.βœ… πŸ”’πŸ”§πŸ’‘
no-misused-observablesDisallow Observables in places not designed to handle them.πŸ”’πŸ’­
no-nested-subscribeDisallow calling subscribe within a subscribe callback.βœ… πŸ”’πŸ’­
no-redundant-notifyDisallow sending redundant notifications from completed or errored observables.βœ… πŸ”’πŸ’­
no-sharereplayDisallow unsafe shareReplay usage.βœ… πŸ”’
no-sharereplay-before-takeuntilDisallow using shareReplay({ refCount: false }) before takeUntil.πŸ”’
no-subclassDisallow subclassing RxJS classes.πŸ”’πŸ’­
no-subject-unsubscribeDisallow calling the unsubscribe method of subjects.βœ… πŸ”’πŸ’­
no-subject-valueDisallow accessing the value property of a BehaviorSubject instance.πŸ’­
no-subscribe-handlersDisallow passing handlers to subscribe.πŸ’­
no-subscribe-in-pipeDisallow calling of subscribe within any RxJS operator inside a pipe.βœ… πŸ”’πŸ’­
no-topromiseDisallow use of the toPromise method.βœ… πŸ”’πŸ’‘πŸ’­
no-unbound-methodsDisallow passing unbound methods.βœ… πŸ”’πŸ’­
no-unnecessary-collectionDisallow unnecessary usage of collection arguments with single values.πŸ”’
no-unsafe-catchDisallow unsafe catchError usage in effects and epics.πŸ’­
no-unsafe-firstDisallow unsafe first/take usage in effects and epics.πŸ’­
no-unsafe-subject-nextDisallow unsafe optional next calls.βœ… πŸ”’πŸ’­
no-unsafe-switchmapDisallow unsafe switchMap usage in effects and epics.πŸ’­
no-unsafe-takeuntilDisallow applying operators after takeUntil.βœ… πŸ”’πŸ’­
prefer-observerDisallow passing separate handlers to subscribe and tap.βœ… πŸ”’πŸ”§πŸ’‘πŸ’­
prefer-root-operatorsDisallow importing operators from rxjs/operators.βœ… πŸ”’πŸ”§πŸ’‘
suffix-subjectsEnforce the use of a suffix in subject identifiers.πŸ’­
throw-errorEnforce passing only Error values to throwError or Subject.error.βœ… πŸ”’πŸ’‘πŸ’­