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 ruleP2universalStack: typescript
eventspayloadstructuretypes
Structure event payloads as an action with a nested data object
Group event payload fields under a typed data object alongside the action discriminator instead of a flat, loosely structured bag.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | dispatch({ action: 'edit', id, ticker, category, title, content, pinned }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | dispatch({ |
| 2 | action: 'edit', |
| 3 | data: { id, ticker, category, title, content, pinned }, |
| 4 | }); |
Explanation (EN)
Objašnjenje (HR)