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).
backend ruleP2universalStack: TypeScript
typescriptclean-codeinterfacesyagni
Inline single-use interfaces instead of declaring a separate type
If an interface is used in exactly one place, consider inlining the shape to keep the code compact rather than creating a dedicated declaration file.
PR: vinify-backend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | // inclusion.interface.ts |
| 2 | export interface Inclusion { id: number; } |
| 3 | // only used once |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | function handle(inclusion: { id: number }) { ... } |
Explanation (EN)
Objašnjenje (HR)