eslint-plugin-rxjs-angular:RxJS和Angular的ESLint规则

  • s9_938327
    了解作者
  • 67.1KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-15 00:44
    上传日期
eslint-plugin-rxjs-angular 该软件包包含rxjs 软件包中的Angular / RxJS规则的ESLint版本。 此软件包没有建议的配置,因为所有规则都已确定。 安装 使用npm安装ESLint TypeScript解析器: npm install @typescript-eslint/parser --save-dev 使用npm安装软件包: npm install eslint-plugin-rxjs-angular --save-dev 配置parser和parserOptions的ESLint。在这里,我使用.eslintrc.js文件进行配置: const { join } = require ( "path" ) ; module . exports = { parser : "@typescript-eslint/parser" , p
eslint-plugin-rxjs-angular-main.zip
  • eslint-plugin-rxjs-angular-main
  • .eslintrc.json
    254B
  • source
  • utils.ts
    408B
  • index.ts
    249B
  • rules
  • prefer-takeuntil.ts
    11.8KB
  • prefer-async-pipe.ts
    1.7KB
  • prefer-composition.ts
    9.1KB
  • .github
  • FUNDING.yml
    721B
  • yarn.lock
    109.3KB
  • tsconfig-dist.json
    125B
  • .circleci
  • config.yml
    685B
  • CONTRIBUTING.md
    94B
  • tsconfig.json
    481B
  • LICENSE
    1KB
  • README.md
    2.7KB
  • docs
  • rules
  • prefer-composition.md
    1.6KB
  • prefer-async-pipe.md
    443B
  • prefer-takeuntil.md
    2KB
  • .editorconfig
    259B
  • tests
  • .eslintrc.json
    60B
  • utils.ts
    275B
  • tsconfig.json
    185B
  • rules
  • prefer-takeuntil.ts
    17.3KB
  • prefer-async-pipe.ts
    1.2KB
  • prefer-composition.ts
    5.9KB
  • .gitignore
    48B
  • CHANGELOG.md
    1.3KB
  • package.json
    2.3KB
内容介绍
# 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 |
评论
    相关推荐