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
readabilityarraysshorthand
Simplify a callback that only checks truthiness
When filtering/some-ing on whether a value is truthy, return the value/access directly instead of an explicit comparison block.
PR: vinify-frontend · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | rows.some(row => { |
| 2 | const value = row[key]; |
| 3 | return value !== undefined && value !== null && value !== ''; |
| 4 | }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | rows.some(row => row[key]); |
Explanation (EN)
Objašnjenje (HR)