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 ruleP1universalStack: TypeScript
api-designnamingdata-mappingmaintainability
Do not reuse a source field name when you change its meaning
If you remap an upstream value into a field that no longer means what the upstream name implies, define your own DTO with a clearly named field. Reusing the original name hides the transformation and misleads debugging.
PR: hegnar-user-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | // upstream diff1d means price change, but for bonds we put yield change in it |
| 2 | instrument.diff1d = instrument.diffyield1d; // same name, different meaning |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | interface OurInstrument { valueChange1Day: number; } |
| 2 | const mapped: OurInstrument = { |
| 3 | valueChange1Day: isBond ? instrument.diffyield1d : instrument.diff1d, |
| 4 | }; |
Explanation (EN)
Objašnjenje (HR)