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 ruleP2stack specificStack: typescript
testingvitesttypescripttypes
Use the Mock type from vitest instead of ReturnType<typeof vi.fn>
Type mock functions with import type { Mock } from 'vitest' rather than the verbose ReturnType<typeof vi.fn>.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | let statusMock: ReturnType<typeof vi.fn>; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | import type { Mock } from 'vitest'; |
| 2 | let statusMock: Mock; |
Explanation (EN)
Objašnjenje (HR)