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
formattingbugs
Do not rely on Automatic Semicolon Insertion
Always end statements with semicolons to avoid ASI edge-case bugs.
Created: Feb 10, 2026
Bad example
Old codets
| 1 | const value = 1 |
| 2 | (function run() { |
| 3 | console.log(value) |
| 4 | })() |
Explanation (EN)
ASI can turn valid-looking code into different statements depending on formatting, creating hard-to-spot bugs.
Objašnjenje (HR)
ASI može promijeniti značenje koda ovisno o formatiranju i stvoriti bugove koje je teško vidjeti u reviewu.
Good example
New codets
| 1 | const value = 1; |
| 2 | (function run() { |
| 3 | console.log(value); |
| 4 | })(); |
Explanation (EN)
Semicolons make statement boundaries explicit and tool-friendly.
Objašnjenje (HR)
Točke-zarezi čine granice izjava eksplicitnima i kompatibilnima s alatima.