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
interfacesabstractionooparchitecture
Implement an interface fully rather than stubbing methods that throw
Extending a base/interface but stubbing required methods with 'throw new Error(not implemented)' signals the wrong abstraction; implement them or pick a better base.
PR: hegnar-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | public orderBy(order: string): this { |
| 2 | throw new Error('Method not implemented.'); |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | public orderBy(order: OrderableKey): this { |
| 2 | if (order === OrderableKey.Date) this.orderByDate('desc'); |
| 3 | return this; |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)