Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Declare needed @types packages explicitly in tsconfig types
Configure global type packages for the actual TypeScript version and target; types does not list every imported module type.
Bad example
| 1 | { |
| 2 | "compilerOptions": { |
| 3 | "types": ["vitest/globals"] |
| 4 | } |
| 5 | } |
Explanation (EN)
A restrictive list that omits required Node globals can make process and other platform types unavailable.
Objašnjenje (HR)
Good example
| 1 | { |
| 2 | "compilerOptions": { |
| 3 | "types": ["node", "vitest/globals"] |
| 4 | } |
| 5 | } |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
Inspect the installed TypeScript version and effective configuration before defining the global type package allowlist. TypeScript 6 defaults types to an empty list; earlier versions include visible @types by default.
Exceptions / Tradeoffs (EN)
An explicit types array restricts automatic global inclusion, not types obtained through module imports. Add only globals used by that build/test target; avoid leaking test globals into production config.