Installations
npm install eslint-plugin-rxjs
Releases
Unable to fetch releases
Developer
cartant
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
14.18.0
NPM Version
6.14.15
Statistics
312 Stars
614 Commits
37 Forks
6 Watching
4 Branches
14 Contributors
Updated on 16 Nov 2024
Languages
TypeScript (99.98%)
Shell (0.02%)
Total Downloads
Cumulative downloads
Total Downloads
32,719,962
Last day
-7.8%
44,897
Compared to previous day
Last week
5%
253,787
Compared to previous week
Last month
4.3%
1,046,268
Compared to previous month
Last year
22%
11,688,409
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
9
Peer Dependencies
2
eslint-plugin-rxjs
This package contains a bunch of ESLint rules for RxJS. Essentially, it's a re-implementation of the rules that are in the rxjs-tslint-rules
package. (The Angular-specific rules in rxjs-tslint-rules
have been re-implemented in eslint-plugin-rxjs-angular
.)
Some of the rules are rather opinionated and are not included in the recommended
configuration. Developers can decide for themselves whether they want to enable opinionated rules.
Almost all of these rules require the TypeScript parser for ESLint.
Install
Install the ESLint TypeScript parser using npm:
npm install @typescript-eslint/parser --save-dev
Install the package using npm:
npm install eslint-plugin-rxjs --save-dev
Configure the parser
and the parserOptions
for ESLint. Here, I use a .eslintrc.js
file for the configuration:
1const { join } = require("path"); 2module.exports = { 3 parser: "@typescript-eslint/parser", 4 parserOptions: { 5 ecmaVersion: 2019, 6 project: join(__dirname, "./tsconfig.json"), 7 sourceType: "module" 8 }, 9 plugins: ["rxjs"], 10 extends: [], 11 rules: { 12 "rxjs/no-async-subscribe": "error", 13 "rxjs/no-ignored-observable": "error", 14 "rxjs/no-ignored-subscription": "error", 15 "rxjs/no-nested-subscribe": "error", 16 "rxjs/no-unbound-methods": "error", 17 "rxjs/throw-error": "error" 18 } 19};
Or, using the recommended
configuration:
1const { join } = require("path"); 2module.exports = { 3 parser: "@typescript-eslint/parser", 4 parserOptions: { 5 ecmaVersion: 2019, 6 project: join(__dirname, "./tsconfig.json"), 7 sourceType: "module" 8 }, 9 extends: ["plugin:rxjs/recommended"], 10};
Rules
The package includes the following rules.
Rules marked with ✅ are recommended and rules marked with 🔧 have fixers.
Rule | Description | ||
---|---|---|---|
ban-observables | Forbids the use of banned observables. | ||
ban-operators | Forbids the use of banned operators. | ||
finnish | Enforces the use of Finnish notation. | ||
just | Enforces the use of a just alias for of . | 🔧 | |
no-async-subscribe | Forbids passing async functions to subscribe . | ✅ | |
no-compat | Forbids importation from locations that depend upon rxjs-compat . | ||
no-connectable | Forbids operators that return connectable observables. | ||
no-create | Forbids the calling of Observable.create . | ✅ | |
no-cyclic-action | Forbids effects and epics that re-emit filtered actions. | ||
no-explicit-generics | Forbids explicit generic type arguments. | ||
no-exposed-subjects | Forbids exposed (i.e. non-private) subjects. | ||
no-finnish | Forbids the use of Finnish notation. | ||
no-ignored-error | Forbids the calling of subscribe without specifying an error handler. | ||
no-ignored-notifier | Forbids observables not composed from the repeatWhen or retryWhen notifier. | ✅ | |
no-ignored-observable | Forbids the ignoring of observables returned by functions. | ||
no-ignored-replay-buffer | Forbids using ReplaySubject , publishReplay or shareReplay without specifying the buffer size. | ✅ | |
no-ignored-subscribe | Forbids the calling of subscribe without specifying arguments. | ||
no-ignored-subscription | Forbids ignoring the subscription returned by subscribe . | ||
no-ignored-takewhile-value | Forbids ignoring the value within takeWhile . | ✅ | |
no-implicit-any-catch | Like the no-implicit-any-catch rule in @typescript-eslint/eslint-plugin , but for the catchError operator instead of catch clauses. | ✅ | 🔧 |
no-index | Forbids the importation from index modules - for the reason, see this issue. | ✅ | |
no-internal | Forbids the importation of internals. | ✅ | 🔧 |
no-nested-subscribe | Forbids the calling of subscribe within a subscribe callback. | ✅ | |
no-redundant-notify | Forbids redundant notifications from completed or errored observables. | ✅ | |
no-sharereplay | Forbids using the shareReplay operator. | ✅ | |
no-subclass | Forbids subclassing RxJS classes. | ||
no-subject-unsubscribe | Forbids calling the unsubscribe method of a subject instance. | ✅ | |
no-subject-value | Forbids accessing the value property of a BehaviorSubject instance. | ||
no-subscribe-handlers | Forbids the passing of handlers to subscribe . | ||
no-topromise | Forbids the use of the toPromise method. | ||
no-unbound-methods | Forbids the passing of unbound methods. | ✅ | |
no-unsafe-catch | Forbids unsafe catchError usage in effects and epics. | ||
no-unsafe-first | Forbids unsafe first /take usage in effects and epics. | ||
no-unsafe-subject-next | Forbids unsafe optional next calls. | ✅ | |
no-unsafe-switchmap | Forbids unsafe switchMap usage in effects and epics. | ||
no-unsafe-takeuntil | Forbids the application of operators after takeUntil . | ✅ | |
prefer-observer | Forbids the passing separate handlers to subscribe and tap . | 🔧 | |
suffix-subjects | Enforces the use of a suffix in subject identifiers. | ||
throw-error | Enforces the passing of Error values to error notifications. |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 3/30 approved changesets -- score normalized to 1
Reason
9 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-f9xv-q969-pqx4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 3 are checked with a SAST tool
Score
2
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More