Skip to content

noProcessGlobal

Disallow the use of process global.

Node.js and Deno expose process global but they are hard to statically analyze by tools, so code should not assume they are available. Instead, import process from "node:process".

const foo = process.env.FOO;
code-block.js:1:13 lint/nursery/noProcessGlobal  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Usage of the process global is discouraged.

> 1 │ const foo = process.env.FOO;
^^^^^^^
2 │

process global is hard for tools to statically analyze, so code should not assume they are available.

Safe fix: Add import process from "node:process"; to this file’s imports.

1+ import·process·from·node::process;
1 2 const foo = process.env.FOO;
2 3

import process from "node:process";
const foo = process.env.FOO;

The rule is not able to detect cases where the global object is aliased:

const foo = globalThis;
const bar = foo.process;
biome.json
{
"linter": {
"rules": {
"nursery": {
"noProcessGlobal": "error"
}
}
}
}