3.0.0 • Published 4 years ago
eslint-plugin-ngxs-style-guide v3.0.0
eslint-plugin-ngxs-style-guide
ESLint rules for ngxs state manager.
Install
npm install --save-dev eslint-plugin-ngxs-style-guideUsage
Configure it in your configuration file:
- Add to
pluginssection:
ngxs-style-guide- Add to
extendssection (optional):
plugin:ngxs-style-guide/recommendedRules
NGXS style guide - https://www.ngxs.io/recipes/style-guide
ngxs-style-guide/state-suffixA state should always be suffixed with the wordState. Right:ZooStateWrong:Zoongxs-style-guide/state-filenamesStates should have a.state.tssuffix for the filenamengxs-style-guide/state-interfacesState interfaces should be named the name of the state followed by theModelsuffixngxs-style-guide/select-suffixSelects should have a$suffixngxs-style-guide/action-suffixesActions should NOT have a suffixngxs-style-guide/plugin-suffixPlugins should end with thePluginsuffix
Other rules
ngxs-style-guide/no-subscribe-in-actionsPossible error https://stackoverflow.com/questions/56122116/do-not-subscribe-to-actions-ngxsngxs-style-guide/no-pipe-dispatchNo pipe() after dispatch
Todo
- return observable from action
- selector inject it must be after @State({ name: 'supplier', defaults: defaultState, }) @Injectable({ providedIn: 'root' })