]> git.proxmox.com Git - pve-eslint.git/blob - eslint/lib/rules/no-process-exit.js
29871660cc6ee14c5b6d8201dc921e501d2b07cc
[pve-eslint.git] / eslint / lib / rules / no-process-exit.js
1 /**
2 * @fileoverview Disallow the use of process.exit()
3 * @author Nicholas C. Zakas
4 */
5 "use strict";
6
7 //------------------------------------------------------------------------------
8 // Rule Definition
9 //------------------------------------------------------------------------------
10
11 module.exports = {
12 meta: {
13 type: "suggestion",
14
15 docs: {
16 description: "disallow the use of `process.exit()`",
17 category: "Node.js and CommonJS",
18 recommended: false,
19 url: "https://eslint.org/docs/rules/no-process-exit"
20 },
21
22 schema: [],
23
24 messages: {
25 noProcessExit: "Don't use process.exit(); throw an error instead."
26 }
27 },
28
29 create(context) {
30
31 //--------------------------------------------------------------------------
32 // Public
33 //--------------------------------------------------------------------------
34
35 return {
36 "CallExpression > MemberExpression.callee[object.name = 'process'][property.name = 'exit']"(node) {
37 context.report({ node: node.parent, messageId: "noProcessExit" });
38 }
39 };
40
41 }
42 };