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: JavaScript/TypeScript
destructuringclean-codeobjectsshorthand
Use object rest destructuring to omit properties concisely
To strip a field from each object in a list, destructure with rest instead of manual reconstruction.
PR: hegnar-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | const cleaned = items.map((item) => ({ |
| 2 | id: item.id, |
| 3 | name: item.name, // manually copying to drop `tags` |
| 4 | })); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const cleaned = items.map(({ tags, ...rest }) => rest); |
Explanation (EN)
Objašnjenje (HR)