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).
Document non-obvious workarounds with a linked upstream issue
Annotate any non-obvious workaround or suspicious config line with a comment explaining why, and link the upstream issue/PR that justifies it.
Bad example
| 1 | // Pin/pre-bundle these deps. |
| 2 | optimizeDeps: { |
| 3 | include: ['msw', 'msw/browser', 'vitest-browser-react'], |
| 4 | }, |
Explanation (EN)
The comment restates what the code does but not why it is needed. A future maintainer can't tell whether the workaround is still required or safe to remove.
Objašnjenje (HR)
Komentar ponavlja sto kod radi, ali ne i zasto je potreban. Buduci odrzavatelj ne moze znati je li zaobilazno rjesenje jos uvijek potrebno ili ga je sigurno ukloniti.
Good example
| 1 | // Pre-bundle these test-only deps so the runner doesn't re-optimize them |
| 2 | // mid-suite, which causes flaky dynamic imports in browser mode. |
| 3 | // Workaround for upstream bug: vitest-dev/vitest#9509 (remove when fixed). |
| 4 | optimizeDeps: { |
| 5 | include: ['msw', 'msw/browser', 'vitest-browser-react'], |
| 6 | }, |
Explanation (EN)
The comment explains the symptom being worked around and links the upstream issue, so the next maintainer can check whether it's fixed and delete the workaround safely.
Objašnjenje (HR)
Komentar objasnjava simptom koji se zaobilazi i povezuje upstream issue, pa sljedeci odrzavatelj moze provjeriti je li ispravljeno i sigurno ukloniti zaobilazno rjesenje.
Notes (EN)
Confirm the workaround is actually needed before adding it (reproduce the failure, search for newer fixed versions). Linking a resolved or open upstream issue documents that due diligence.
Bilješke (HR)
Prije dodavanja potvrdi da je zaobilazno rjesenje stvarno potrebno (reproduciraj gresku, potrazi novije ispravljene verzije). Povezivanje rijesenog ili otvorenog upstream issuea dokumentira tu provjeru.