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).
backend ruleP2universalStack: TypeScript
clean-codevariablesreadabilityredundancy
Don't initialize a variable you immediately overwrite in every branch
If every branch assigns a variable, declare it with a type and no initial value rather than giving it a throwaway default that is always overwritten.
PR: vinify-backend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | let where: WhereOperators = {}; |
| 2 | if (over) { where = a; } else { where = b; } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | let where: WhereOperators; |
| 2 | if (over) { where = a; } else { where = b; } |
Explanation (EN)
Objašnjenje (HR)