This repository has been archived on 2022-01-16. You can view files and clone it, but cannot push or open issues or pull requests.
irreligious/node_modules/eslint/lib/rules/no-process-exit.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-09-04 22:21:14 -05:00
/**
* @fileoverview Disallow the use of process.exit()
* @author Nicholas C. Zakas
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
deprecated: true,
replacedBy: [],
type: "suggestion",
docs: {
description: "disallow the use of `process.exit()`",
category: "Node.js and CommonJS",
recommended: false,
url: "https://eslint.org/docs/rules/no-process-exit"
},
schema: [],
messages: {
noProcessExit: "Don't use process.exit(); throw an error instead."
}
},
create(context) {
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
"CallExpression > MemberExpression.callee[object.name = 'process'][property.name = 'exit']"(node) {
context.report({ node: node.parent, messageId: "noProcessExit" });
}
};
}
};