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 ruleP1universalStack: javascript
browserenvbundlingcorrectness
Don't reference process.env in browser-only code
Client code can't access process; use a build-injected value, a passed config, or a relative path instead.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | const url = `${process.env.ORIGIN}/tickers/${insref}/marketdata`; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const url = `/tickers/${insref}/marketdata`; // relative, or use injected config |
Explanation (EN)
Objašnjenje (HR)