eslint-plugin-ngxs-style-guide
v3.0.0
Published
ESLint rules for ngxs state manager
Downloads
2,145
Maintainers
Readme
eslint-plugin-ngxs-style-guide
ESLint rules for ngxs state manager.
Install
npm install --save-dev eslint-plugin-ngxs-style-guide
Usage
Configure it in your configuration file:
- Add to
plugins
section:
ngxs-style-guide
- Add to
extends
section (optional):
plugin:ngxs-style-guide/recommended
Rules
NGXS style guide - https://www.ngxs.io/recipes/style-guide
ngxs-style-guide/state-suffix
A state should always be suffixed with the wordState
. Right:ZooState
Wrong:Zoo
ngxs-style-guide/state-filenames
States should have a.state.ts
suffix for the filenamengxs-style-guide/state-interfaces
State interfaces should be named the name of the state followed by theModel
suffixngxs-style-guide/select-suffix
Selects should have a$
suffixngxs-style-guide/action-suffixes
Actions should NOT have a suffixngxs-style-guide/plugin-suffix
Plugins should end with thePlugin
suffix
Other rules
ngxs-style-guide/no-subscribe-in-actions
Possible error https://stackoverflow.com/questions/56122116/do-not-subscribe-to-actions-ngxsngxs-style-guide/no-pipe-dispatch
No pipe() after dispatch
Todo
- return observable from action
- selector inject it must be after @State({ name: 'supplier', defaults: defaultState, }) @Injectable({ providedIn: 'root' })