n/no-process-env
eslint-plugin-n
No autofix
eslint.config.js
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/no-process-env": "error",
},
},
];if(process.env.NODE_ENV === "development") {
//...
}var config = require("./config");
if(config.env === "development") {
//...
}Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
n/no-process-env
eslint-plugin-n
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/no-process-env": "error",
},
},
];node/no-process-env
node plugin · restriction
{
"plugins": [
"node"
],
"rules": {
"node/no-process-env": "error"
}
}style/noProcessEnv
style · since 1.9.1
{
"linter": {
"rules": {
"style": {
"noProcessEnv": "error"
}
}
}
}Enforce using process.getBuiltinModule() to load Node.js built-in modules
Enforce the style of file extensions in import declarations