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).
frontend ruleP2universalStack: javascript
javascriptarraysredundancyreadability
Don't guard .map() with a length check
map() over an empty array simply produces an empty array, so a preceding `arr.length > 0 &&` guard around a map is redundant.
PR: hegnar-zephr-components · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | {items.length > 0 && items.map(item => <Row key={item.id} {...item} />)} |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | {items.map(item => <Row key={item.id} {...item} />)} |
Explanation (EN)
Objašnjenje (HR)