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
readabilitydiffs
Declare one variable per statement
Avoid comma-separated declarations for clarity and simpler diffs.
Created: Feb 10, 2026
Bad example
Old codets
| 1 | let a = 1, b = 2; |
Explanation (EN)
Multiple declarations in one statement make diffs noisier and hide intent when one variable changes.
Objašnjenje (HR)
Više deklaracija u jednoj liniji otežava diff i skriva namjeru kada se mijenja samo jedna varijabla.
Good example
New codets
| 1 | let a = 1; |
| 2 | let b = 2; |
Explanation (EN)
One declaration per line keeps changes focused and easier to review.
Objašnjenje (HR)
Jedna deklaracija po liniji čini promjene fokusiranima i lakšima za review.