Socket
Book a DemoInstallSign in
Socket

ngrx-tslint-rules

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngrx-tslint-rules

TSLint rules for NgRx

latest
Source
npmnpm
Version
2.1.4
Version published
Maintainers
1
Created
Source

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

RuleDescriptionExamples
ngrx-action-hygieneEnforces the use of good action hygieneExample
ngrx-avoid-dispatching-multiple-actions-sequentiallyIt is recommended to only dispatch one action at a timeExample
ngrx-effect-creator-and-decoratorAn Effect should only use the effect creator (createEffect) or the Effect decorator (@Effect), but not both simultaneouslyExample
ngrx-no-dispatch-in-effectsAn Effect should not call store.dispatch, but should return an actionExample
ngrx-no-duplicate-action-typesAn action type must be uniqueExample
ngrx-no-effect-decoratorThe createEffect creator function is preferredExample
ngrx-no-effects-in-providersThe Effect should not be listed as a provider if it is added to the EffectsModuleExample
ngrx-no-multiple-actions-in-effectsAn Effect should not return multiple actionsExample
ngrx-no-multiple-storesStore should at most be one time injectedExample
ngrx-no-reducer-in-key-namesAvoid the word "reducer" in the key namesExample
ngrx-no-typed-storeA store should not be typedExample
ngrx-selector-for-selectUsing string or props drilling is not preferred, use a selector insteadExample

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
  }
}
RuleDescriptionExamples
ngrx-on-reducer-explicit-return-typeEnforces type safety for on reducer callbacksExample

License

MIT

Keywords

NgRx

FAQs

Package last updated on 18 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts