2.1.4 • Published 4 years ago

ngrx-tslint-rules v2.1.4

Weekly downloads
911
License
MIT
Repository
github
Last release
4 years ago

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

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.16.1

5 years ago

1.16.0

5 years ago

1.15.0

5 years ago

1.14.1

5 years ago

1.14.0

5 years ago

1.13.1

5 years ago

1.13.0

5 years ago

1.12.0

5 years ago

1.11.0

5 years ago

1.10.1

5 years ago

1.10.0

5 years ago

1.9.0

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.5

5 years ago

1.5.4

5 years ago

1.5.3

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago