Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Apply mechanical/codemod refactors uniformly across the change
When a refactor applies the same transformation repeatedly (renaming, prefixing, swapping utilities), convert every occurrence consistently or document why specific ones are intentionally left as-is.
Bad example
| 1 | // Most occurrences prefixed, a few left unprefixed with no explanation |
| 2 | className="zp:relative zp:block focus:outline-none" |
| 3 | className="zp:flex zp:items-center space-x-1" |
Explanation (EN)
Some tokens got the new prefix/utility and others didn't, with no comment explaining the difference, so a reviewer can't tell if the leftover is a bug or intentional.
Objašnjenje (HR)
Neki tokeni dobili su novi prefiks/utility, a drugi nisu, bez komentara koji objasnjava razliku, pa recenzent ne moze znati je li ostatak greska ili namjera.
Good example
| 1 | // Either convert everything... |
| 2 | className="zp:relative zp:block zp:focus:outline-none" |
| 3 | // ...or leave it out deliberately with a reason |
| 4 | // keep space-x here: this element is not a flex container, gap would not apply |
| 5 | className="zp:flex zp:items-center space-x-1" |
Explanation (EN)
Every token is either consistently transformed or explicitly annotated with the reason it was skipped, removing ambiguity for reviewers.
Objašnjenje (HR)
Svaki token je ili dosljedno transformiran ili eksplicitno oznacen razlogom zasto je preskocen, cime se uklanja dvosmislenost za recenzente.
Notes (EN)
Codemods can miss cases; after running one, grep for the old pattern to catch stragglers and decide deliberately for each remaining one.
Bilješke (HR)
Codemodi mogu propustiti slucajeve; nakon pokretanja pretrazi stari obrazac da uhvatis zaostatke i za svaki preostali odluci namjerno.