]> git.proxmox.com Git - pve-eslint.git/blame - eslint/lib/rules/no-process-exit.js
import 8.41.0 source
[pve-eslint.git] / eslint / lib / rules / no-process-exit.js
CommitLineData
eb39fafa
DC
1/**
2 * @fileoverview Disallow the use of process.exit()
3 * @author Nicholas C. Zakas
609c276f 4 * @deprecated in ESLint v7.0.0
eb39fafa
DC
5 */
6"use strict";
7
8//------------------------------------------------------------------------------
9// Rule Definition
10//------------------------------------------------------------------------------
11
34eeec05 12/** @type {import('../shared/types').Rule} */
eb39fafa
DC
13module.exports = {
14 meta: {
56c4a2cb
DC
15 deprecated: true,
16
ebb53d86 17 replacedBy: [],
56c4a2cb 18
eb39fafa
DC
19 type: "suggestion",
20
21 docs: {
8f9d1d4d 22 description: "Disallow the use of `process.exit()`",
eb39fafa 23 recommended: false,
f2a92ac6 24 url: "https://eslint.org/docs/latest/rules/no-process-exit"
eb39fafa
DC
25 },
26
27 schema: [],
28
29 messages: {
30 noProcessExit: "Don't use process.exit(); throw an error instead."
31 }
32 },
33
34 create(context) {
35
36 //--------------------------------------------------------------------------
37 // Public
38 //--------------------------------------------------------------------------
39
40 return {
41 "CallExpression > MemberExpression.callee[object.name = 'process'][property.name = 'exit']"(node) {
42 context.report({ node: node.parent, messageId: "noProcessExit" });
43 }
44 };
45
46 }
47};