Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP1universalStack: typescript
correctnessuxerror-handling
Don't skip a confirmation step when its data helper fails
If the function building confirmation data returns null/throws, abort or show a fallback — never silently proceed with the destructive action.
PR: hegnar-forum-web · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codets
| 1 | const data = getConfirmData(); |
| 2 | if (data) showModal(data); |
| 3 | else remove(); // skips the confirmation we wanted |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | const data = getConfirmData(); |
| 2 | if (!data) return showError(); |
| 3 | showModal(data); |
Explanation (EN)
Objašnjenje (HR)