Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cartant/eslint-plugin-rxjs-angular
ESLint rules for RxJS and Angular
https://github.com/cartant/eslint-plugin-rxjs-angular
Last synced: 7 days ago
JSON representation
ESLint rules for RxJS and Angular
- Host: GitHub
- URL: https://github.com/cartant/eslint-plugin-rxjs-angular
- Owner: cartant
- License: mit
- Created: 2019-11-23T23:55:28.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-10T18:00:37.000Z (9 months ago)
- Last Synced: 2024-10-29T11:19:06.785Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 490 KB
- Stars: 98
- Watchers: 4
- Forks: 11
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-rxjs-angular
[![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/cartant/eslint-plugin-rxjs-angular/blob/master/LICENSE)
[![NPM version](https://img.shields.io/npm/v/eslint-plugin-rxjs-angular.svg)](https://www.npmjs.com/package/eslint-plugin-rxjs-angular)
[![Downloads](http://img.shields.io/npm/dm/eslint-plugin-rxjs-angular.svg)](https://npmjs.org/package/eslint-plugin-rxjs-angular)
[![Build status](https://img.shields.io/circleci/build/github/cartant/eslint-plugin-rxjs-angular?token=d3e3fd6613244558287da156fd9e0c4357a2170c)](https://app.circleci.com/pipelines/github/cartant)
[![dependency status](https://img.shields.io/david/cartant/eslint-plugin-rxjs-angular.svg)](https://david-dm.org/cartant/eslint-plugin-rxjs-angular)
[![devDependency Status](https://img.shields.io/david/dev/cartant/eslint-plugin-rxjs-angular.svg)](https://david-dm.org/cartant/eslint-plugin-rxjs-angular#info=devDependencies)
[![peerDependency Status](https://img.shields.io/david/peer/cartant/eslint-plugin-rxjs-angular.svg)](https://david-dm.org/cartant/eslint-plugin-rxjs-angular#info=peerDependencies)This package contains ESLint versions of the Angular/RxJS rules that are in the [`rxjs-tslint-rules`](https://github.com/cartant/rxjs-tslint-rules) package.
There is no recommended configuration for this package, as all of the rules are opinionated.
# 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-angular --save-dev
```Configure the `parser` and the `parserOptions` for ESLint. Here, I use a `.eslintrc.js` file for the configuration:
```js
const { join } = require("path");
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2019,
project: join(__dirname, "./tsconfig.json"),
sourceType: "module"
},
plugins: ["rxjs-angular"],
extends: [],
rules: {
"rxjs-angular/prefer-async-pipe": "error"
}
};
```# Rules
The package includes the following rules:
| Rule | Description | Recommended |
| --- | --- | --- |
| [`prefer-async-pipe`](https://github.com/cartant/eslint-plugin-rxjs-angular/blob/main/docs/rules/prefer-async-pipe.md) | Forbids the calling of `subscribe` within Angular components. | No |
| [`prefer-composition`](https://github.com/cartant/eslint-plugin-rxjs-angular/blob/main/docs/rules/prefer-composition.md) | Forbids `subscribe` calls that are not composed within Angular components (and, optionally, within services, directives, and pipes). | No |
| [`prefer-takeuntil`](https://github.com/cartant/eslint-plugin-rxjs-angular/blob/main/docs/rules/prefer-takeuntil.md) | Forbids Calling `subscribe` without an accompanying `takeUntil`. | No |