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
asyncclean-codecorrectnesspromises
Only mark a function async when it actually awaits
Don't add async to a function with no await inside; it adds an unnecessary promise wrapper and obscures intent.
PR: hegnar-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | const handler = async (req, res) => { |
| 2 | res.json(buildDocs()); |
| 3 | }; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const handler = (req, res) => { |
| 2 | res.json(buildDocs()); |
| 3 | }; |
Explanation (EN)
Objašnjenje (HR)