Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Don't return a value that callers always ignore
If a function's return value is never used, either use it or don't return it, so the signature reflects reality.
Bad example
| 1 | function purge(): boolean { /* ... */ return true; } |
| 2 | purge(); // boolean ignored everywhere |
Explanation (EN)
An always-ignored constant result can misrepresent a private operation's contract.
Objašnjenje (HR)
Good example
| 1 | function purge(): void { /* ... */ } |
| 2 | purge(); |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
Remove an unused return value from a private implementation after checking every caller, callback protocol, override and public compatibility contract.
Exceptions / Tradeoffs (EN)
A useful public return value need not be consumed by every caller. Fluent APIs and interface-required values remain valid. Preserve side effects of any removed return expression.