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).
Prefer the official package and override peer deps instead of a fork
Don't add a fork just to widen a peer-dependency range; use the official package and override the peer dep in the package manager.
Bad example
| 1 | { |
| 2 | "devDependencies": { |
| 3 | "@someone/vite-plugin-thing-fork": "^1.0.1" |
| 4 | } |
| 5 | } |
| 6 | // The fork exists only because the official plugin's peerDependencies |
| 7 | // don't yet list the bundler version you use. |
Explanation (EN)
Depending on a fork solely to satisfy a peer-dependency range ties you to an unmaintained mirror that will drift from the upstream package and miss its fixes.
Objašnjenje (HR)
Ovisnost o forku samo da bi se zadovoljio raspon peer-dependencyja vezuje te uz neodržavanu kopiju koja će odstupiti od izvornog paketa i propustiti njegove ispravke.
Good example
| 1 | { |
| 2 | "devDependencies": { |
| 3 | "vite-plugin-thing": "^1.0.1" |
| 4 | }, |
| 5 | "pnpm": { |
| 6 | "peerDependencyRules": { |
| 7 | "allowedVersions": { "vite": "8" } |
| 8 | } |
| 9 | } |
| 10 | } |
| 11 | // Use the official package; relax the peer-dependency check via the |
| 12 | // package manager's override mechanism. |
Explanation (EN)
Keep the official package and relax the peer-dependency constraint through the package manager's override mechanism, so you stay on upstream releases.
Objašnjenje (HR)
Zadrži službeni paket i ublaži ograničenje peer-dependencyja kroz mehanizam override-a u package manageru, tako da ostaješ na službenim izdanjima.
Exceptions / Tradeoffs (EN)
A fork is justified when it carries real code changes you need that upstream won't accept — not merely a widened peer range.
Iznimke / Tradeoffi (HR)
Fork je opravdan kad nosi stvarne izmjene koda koje trebaš, a koje upstream neće prihvatiti — ne samo prošireni raspon peer-a.