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).
backend ruleP0universalStack: node
configenvcorrectnessvalidation
Parse boolean environment variables explicitly, never rely on truthiness
Environment variables are strings, so the literal "false" is truthy; compare against the expected string or transform to a real boolean before using it in conditions.
PR: hegnar-user-ws · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | // FEATURE_FLAG="false" is a non-empty string => truthy => feature ON |
| 2 | if (process.env.FEATURE_FLAG) { |
| 3 | enableFeature(); |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // Compare against the string, or transform once at the boundary |
| 2 | const featureEnabled = process.env.FEATURE_FLAG === 'true'; |
| 3 | if (featureEnabled) { |
| 4 | enableFeature(); |
| 5 | } |
Explanation (EN)
Objašnjenje (HR)