enforce either
processorrequire("process")
The process module is defined as a global variable.
process.log(process === require("process")) //β trueIt will be readable if we use either process consistently.
This rule enforces which process we should use.
This rule has a string option.
{
"node/prefer-global/process": ["error", "always" | "never"]
}"always"(default) ... enforces to use the global variableprocessrather thanrequire("process")."never"... enforces to userequire("process")rather than the global variableprocess.
Examples of π incorrect code for this rule:
/*eslint node/prefer-global/process: [error]*/
const process = require("process")
process.exit(0)Examples of π correct code for this rule:
/*eslint node/prefer-global/process: [error]*/
process.exit(0)Examples of π incorrect code for the "never" option:
/*eslint node/prefer-global/process: [error, never]*/
process.exit(0)Examples of π correct code for the "never" option:
/*eslint node/prefer-global/process: [error, never]*/
const process = require("process")
process.exit(0)