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
testingdryreadability
Call a test setup function once and reuse its result
Save the output of a helper to a variable instead of invoking it multiple times in the same test.
PR: hegnar-forum-web · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codets
| 1 | expect(scriptContent()).toContain('x'); |
| 2 | expect(scriptContent()).toContain('y'); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | const content = scriptContent(); |
| 2 | expect(content).toContain('x'); |
| 3 | expect(content).toContain('y'); |
Explanation (EN)
Objašnjenje (HR)