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
validationnull-handlingcorrectness
Account for the cleared/null case when validating selections
When a selection can be unselected (set to null), validation/error clearing must handle that case, not just the selected case.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetsx
| 1 | window.addEventListener(SELECT, e => { setCategoryError(''); }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | window.addEventListener(SELECT, e => { |
| 2 | const { category } = e.detail; |
| 3 | if (category) setCategoryError(''); |
| 4 | }); |
Explanation (EN)
Objašnjenje (HR)