eslint-plugin-rxjs-angular (updated for ESLint v9)
raw JSON → 1.0.50 verified Sat Apr 25 auth: no javascript
Fork of cartant's eslint-plugin-rxjs-angular updated for ESLint v9 compatibility. Current version 1.0.50. Provides three opinionated ESLint rules for enforcing RxJS best practices in Angular components: prefer-async-pipe (forbids calling subscribe in components), prefer-composition (forbids non-composed subscribe calls), and prefer-takeuntil (forbids subscribe without takeUntil). Requires @typescript-eslint/parser and TypeScript project configuration. Not recommended for new projects; prefer the original package if ESLint v8 is acceptable.
Common errors
error Error: Failed to load plugin 'rxjs-angular-updated' ↓
cause Package not installed or not found in node_modules.
fix
Run: npm install eslint-plugin-rxjs-angular-updated --save-dev
error Cannot find module '@typescript-eslint/parser' ↓
cause Missing peer dependency @typescript-eslint/parser.
fix
Run: npm install @typescript-eslint/parser --save-dev
error Definition for rule 'rxjs-angular-updated/prefer-async-pipe' was not found ↓
cause Rule name uses wrong prefix or plugin not configured in plugins array.
fix
Ensure plugin is imported and added to 'plugins' object with key 'rxjs-angular-updated'.
Warnings
breaking Plugin prefix changed from 'rxjs-angular' to 'rxjs-angular-updated'. ↓
fix Update ESLint config: replace 'rxjs-angular/' with 'rxjs-angular-updated/' in plugin and rule references.
breaking ESLint v9 flat config only; .eslintrc.* formats no longer supported. ↓
fix Migrate to flat config (eslint.config.js) as shown in Quickstart.
deprecated Package is a temporary fork; updates are limited to version bumps only. ↓
fix Consider using the original eslint-plugin-rxjs-angular if ESLint v8 is acceptable, or migrate to a maintained alternative.
gotcha Rule names must be prefixed with 'rxjs-angular-updated/' not 'rxjs-angular'. ↓
fix Use 'rxjs-angular-updated/prefer-takeuntil' instead of 'rxjs-angular/prefer-takeuntil'.
gotcha Requires TypeScript parser and project configuration; rules will silently fail without 'project' in parserOptions. ↓
fix Ensure '@typescript-eslint/parser' and parserOptions.project point to valid tsconfig.json.
Install
npm install eslint-plugin-rxjs-angular-updated yarn add eslint-plugin-rxjs-angular-updated pnpm add eslint-plugin-rxjs-angular-updated Imports
- plugin wrong
// Do not require() in ESM context: const plugin = require('eslint-plugin-rxjs-angular-updated');correct// In eslint.config.js: import plugin from 'eslint-plugin-rxjs-angular-updated'; - rules wrong
// Do not import rules directly: import { rules } from 'eslint-plugin-rxjs-angular-updated';correct// In .eslintrc.js: plugins: ['rxjs-angular-updated'] - prefer-async-pipe wrong
// Do not use the original package prefix: 'rxjs-angular/prefer-async-pipe': 'error'correct// In ESLint config: 'rxjs-angular-updated/prefer-async-pipe': 'error'
Quickstart
// eslint.config.js
import plugin from 'eslint-plugin-rxjs-angular-updated';
export default [
{
files: ['**/*.ts'],
languageOptions: {
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
},
plugins: {
'rxjs-angular-updated': plugin,
},
rules: {
'rxjs-angular-updated/prefer-async-pipe': 'error',
'rxjs-angular-updated/prefer-takeuntil': 'error',
},
},
];