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).
fullstack ruleP2universalStack: TypeScript
readabilityconcisenessstyle
Collapse a trivial arrow-function block to a single expression
A callback that only returns an object can drop the block and explicit return in favor of an implicit-return object literal.
PR: hegnar-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | columnTags: this.columnTags.map((tag) => { |
| 2 | return { id: tag.id, name: tag.name }; |
| 3 | }), |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | columnTags: this.columnTags.map((tag) => ({ id: tag.id, name: tag.name })), |
Explanation (EN)
Objašnjenje (HR)