Files
NapCatQQ/.pnpm-store/v3/files/fe/a09d59bdb50920d4a58cc188162566a5bd66c9768bfafac75517cd7d94ffad942c712422fb1ffb3b0f0f4e578c210ac991cbbed9aaa505548221c80d944a71
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

47 lines
1.3 KiB
Plaintext

/**
* @author Toru Nagashima
* See LICENSE file in root directory for full license.
*/
"use strict"
const { READ } = require("@eslint-community/eslint-utils")
const checkForPreferGlobal = require("../../util/check-prefer-global")
const traceMap = {
globals: {
process: { [READ]: true },
},
modules: {
process: { [READ]: true },
"node:process": { [READ]: true },
},
}
/** @type {import('../rule-module').RuleModule} */
module.exports = {
meta: {
docs: {
description: 'enforce either `process` or `require("process")`',
recommended: false,
url: "https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-global/process.md",
},
type: "suggestion",
fixable: null,
schema: [{ enum: ["always", "never"] }],
messages: {
preferGlobal:
"Unexpected use of 'require(\"process\")'. Use the global variable 'process' instead.",
preferModule:
"Unexpected use of the global variable 'process'. Use 'require(\"process\")' instead.",
},
},
create(context) {
return {
"Program:exit"() {
checkForPreferGlobal(context, traceMap)
},
}
},
}