node/no-process-env Restriction
What it does
Disallows use of process.env.
Why is this bad?
Directly reading process.env can lead to implicit runtime configuration, make code harder to test, and bypass configuration validation.
Examples
Examples of incorrect code for this rule:
js
if (process.env.NODE_ENV === "development") {
// ...
}Examples of correct code for this rule:
js
import config from "./config";
if (config.env === "development") {
// ...
}Configuration
allowedVariables
type: string[]
How to use
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny node/no-process-env --node-pluginjson
{
"plugins": ["node"],
"rules": {
"node/no-process-env": "error"
}
}