src/content/docs/linter/rules/no-process-global.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> ## Summary - Rule available since: `v2.0.0` - Diagnostic Category: [`lint/correctness/noProcessGlobal`](/reference/diagnostics#diagnostic-category) - This rule isn't recommended, so you need to enable it. - This rule has a [**safe**](/linter/#safe-fixes) fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - Sources: - Same as [`no-process-global`](https://lint.deno.land/rules/no-process-global){
"linter": {
"rules": {
"correctness": {
"noProcessGlobal": "error"
}
}
}
}
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;
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;