Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

no-process-exit.js 1.1KB

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