Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unlight/eslint-plugin-ngxs-style-guide
ESLint rules for ngxs state manager
https://github.com/unlight/eslint-plugin-ngxs-style-guide
eslint eslint-plugin eslint-rules eslintplugin ngxs
Last synced: 28 days ago
JSON representation
ESLint rules for ngxs state manager
- Host: GitHub
- URL: https://github.com/unlight/eslint-plugin-ngxs-style-guide
- Owner: unlight
- License: mit
- Created: 2019-09-06T13:18:19.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-22T16:32:33.000Z (almost 3 years ago)
- Last Synced: 2024-09-28T11:42:29.569Z (about 1 month ago)
- Topics: eslint, eslint-plugin, eslint-rules, eslintplugin, ngxs
- Language: TypeScript
- Homepage:
- Size: 63.5 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-ngxs-style-guide
ESLint rules for [ngxs](https://www.ngxs.io) state manager.
## Install
```
npm install --save-dev eslint-plugin-ngxs-style-guide
```## Usage
Configure it in [your configuration file](https://eslint.org/docs/user-guide/configuring):
1. Add to `plugins` section:
```
ngxs-style-guide
```2. Add to `extends` section (optional):
```
plugin:ngxs-style-guide/recommended
```3. [Configure rules](https://eslint.org/docs/user-guide/configuring#configuring-rules)
## Rules
### NGXS style guide - https://www.ngxs.io/recipes/style-guide
- `ngxs-style-guide/state-suffix` A state should always be suffixed with the word `State`. Right: `ZooState` Wrong: `Zoo`
- `ngxs-style-guide/state-filenames` States should have a `.state.ts` suffix for the filename
- `ngxs-style-guide/state-interfaces` State interfaces should be named the name of the state followed by the `Model` suffix
- `ngxs-style-guide/select-suffix` Selects should have a `$` suffix
- `ngxs-style-guide/action-suffixes` Actions should NOT have a suffix
- `ngxs-style-guide/plugin-suffix` Plugins should end with the `Plugin` suffix### Other rules
- `ngxs-style-guide/no-subscribe-in-actions` Possible error https://stackoverflow.com/questions/56122116/do-not-subscribe-to-actions-ngxs
- `ngxs-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' })