This package has been deprecated

Author message:

ngrx-tslint-rules is deprecated in favor of eslint-plugin-ngrx. For more info see https://github.com/timdeschryver/eslint-plugin-ngrx

ngrx-tslint-rules
TypeScript icon, indicating that this package has built-in type declarations

2.1.4 • Public • Published

ngrx-tslint-rules

For the ESLint version of this library see, eslint-plugin-ngrx

Installation

Using the Angular CLI

Use the ng-add command from the Angular CLI to be guided with the installation. We'll ask you for which rules you want to enable.

ng add ngrx-tslint-rules

Manual install with npm or yarn

First install ngrx-tslint-rules as a dependency with the following command.

npm install ngrx-tslint-rules --save-dev

Next, add ngrx-tslint-rules to your tslint.json file, and the rules to the rules config.

{
  "extends": ["ngrx-tslint-rules"],
  "rules": {
    ...
  }
}

To enable all recommended rules, use the recommended configuration file.

{
  "extends": ["ngrx-tslint-rules/recommended"]
}

The recommended rules also export the rules from rxjs-tslint-rules that can be applied to NgRx

Recommend Rules

By default all rules are enabled

Rule Description Examples
ngrx-action-hygiene Enforces the use of good action hygiene Example
ngrx-avoid-dispatching-multiple-actions-sequentially It is recommended to only dispatch one action at a time Example
ngrx-effect-creator-and-decorator An Effect should only use the effect creator (createEffect) or the Effect decorator (@Effect), but not both simultaneously Example
ngrx-no-dispatch-in-effects An Effect should not call store.dispatch, but should return an action Example
ngrx-no-duplicate-action-types An action type must be unique Example
ngrx-no-effect-decorator The createEffect creator function is preferred Example
ngrx-no-effects-in-providers The Effect should not be listed as a provider if it is added to the EffectsModule Example
ngrx-no-multiple-actions-in-effects An Effect should not return multiple actions Example
ngrx-no-multiple-stores Store should at most be one time injected Example
ngrx-no-reducer-in-key-names Avoid the word "reducer" in the key names Example
ngrx-no-typed-store A store should not be typed Example
ngrx-selector-for-select Using string or props drilling is not preferred, use a selector instead Example

Optional Rules

To enable optional rules add them to the rules section in your tslint.json file.

{
  "extends": ["ngrx-tslint-rules"],
  "rules": {
    "ngrx-on-reducer-explicit-return-type": true
  }
}
Rule Description Examples
ngrx-on-reducer-explicit-return-type Enforces type safety for on reducer callbacks Example

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i ngrx-tslint-rules

Weekly Downloads

42

Version

2.1.4

License

MIT

Unpacked Size

57.8 kB

Total Files

45

Last publish

Collaborators

  • timdeschryver