github-pages-deploy-action/node_modules/eslint/lib/rules/no-process-exit.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-03-07 11:45:40 +08:00
/**
* @fileoverview Disallow the use of process.exit()
* @author Nicholas C. Zakas
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
2020-05-15 05:33:08 +08:00
deprecated: true,
2020-06-06 22:11:37 +08:00
replacedBy: [],
2020-05-15 05:33:08 +08:00
2020-03-07 11:45:40 +08:00
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"
},
2020-05-15 05:33:08 +08:00
schema: [],
messages: {
noProcessExit: "Don't use process.exit(); throw an error instead."
}
2020-03-07 11:45:40 +08:00
},
create(context) {
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
"CallExpression > MemberExpression.callee[object.name = 'process'][property.name = 'exit']"(node) {
2020-05-15 05:33:08 +08:00
context.report({ node: node.parent, messageId: "noProcessExit" });
2020-03-07 11:45:40 +08:00
}
};
}
};