-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ESLint rule - all ngrx "Fail" actions should have implements ErrorAction
#19042
Conversation
…ror property in actions implementing ErrorAction
… any' - wherever needed. In non-needed places, removed this line.
…ded after renaming the parameter names from 'error' to 'payload'
…payload.error;` with `public error: any;`
…ready `implements ErrorAction` but didn't have public `error` property
… an action that already `extends LoaderFailAction`
… of github.com:SAP/spartacus into feature/CXSPA-7198--v2
…` in epic branch
… deprecate it - OVERLOOKED PLACES
… deprecate it - OVERLOOKED PLACES, part 2
…d`. Moreover create new `error` property based on `payload`.
…r = payload.error`
…o feature/CXSPA-7198--v2
tools/eslint-rules/rules/no-ngrx-fail-action-without-error-action-implementation.spec.ts
Outdated
Show resolved
Hide resolved
feature-libs/cart/base/core/store/actions/cart-voucher.action.ts
Outdated
Show resolved
Hide resolved
feature-libs/product-configurator/rulebased/core/state/actions/configurator.action.ts
Outdated
Show resolved
Hide resolved
this.meta = entityFailMeta(entityType, id, error); | ||
this.error = error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[note]
Here it's OK, to implement this line. Thanks to it, all actions extending this class won't need to implement analogical mapping for this.error
property, I guess.
Same for: LoaderFailAction
and EntityScopedFailAction
tools/eslint-rules/rules/no-ngrx-fail-action-without-error-action-implementation.spec.ts
Outdated
Show resolved
Hide resolved
feature-libs/product-configurator/rulebased/core/state/actions/configurator.action.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too!
Goal: ensure that each NgRx Failure Action in our repo has an
error
property. It's ensured by enforcing each such action to haveimplements ErrorAction
.Means:
/Fail/
in its name but is missingimplements ErrorAction
*.action*.ts
( supposed to be files with NgRx actions )Moreover, the ESLint rule provides an auto-fixer which:
implements ErrorAction
ErrorAction
from@sparatcus/core
in the current fileNote: to run unit tests of the ESLint rule, execute:
fixes https://jira.tools.sap/browse/CXSPA-7756