@rxlint/eslint-plugin-angular
v1.2.13
Published
ESLint rules for RxJS and Angular
Maintainers
Readme
@rxlint/eslint-plugin-angular
This package is a fork of the package cartant/eslint-plugin-rxjs-angular with trimmed and updated dependencies to work with both eslint 8 and 9.
There is no recommended configuration for this package, as all of the rules are opinionated.
Installation
Install the ESLint TypeScript parser using npm:
npm install --save-dev eslint typescript @typescript-eslint/parser @rxlint/eslint-plugin-angular --save-dev
# or
yarn add --dev eslint typescript @typescript-eslint/parser @rxlint/eslint-plugin-angularConfiguration
This plugin should work with both ESLint v8 eslintrc and ESLint v9 eslint.config.js format files.
For ESLint v8, add @rxlint/angular to your plugin array:
.eslintrc.js
module.exports = {
files: ["**/*.ts"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
project: true,
sourceType: "module"
},
plugins: ["@rxlint/angular"],
rules: {
"@rxlint/angular/prefer-async-pipe": "error"
}
};For ESLint v9, import the plugin and map it to a name:
eslint.config.js
const rxjsAngular = require("@rxlint/eslint-plugin-angular");
module.exports = [{
files: ["**/*.ts"],
plugins: {
"@rxlint-angular": rxjsAngular
},
rules: {
"@rxlint-angular/prefer-async-pipe": "error"
}
}];Rules
The package includes the following rules:
| Rule | Description | Recommended |
| --- | --- | --- |
| prefer-async-pipe | Forbids the calling of subscribe within Angular components. | No |
| prefer-composition | Forbids subscribe calls that are not composed within Angular components (and, optionally, within services, directives, and pipes). | No |
| prefer-takeuntil | Forbids Calling subscribe without an accompanying takeUntil. | No |
