租房小程序前端代码
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.

47 lines
1.2 KiB

3 months ago
  1. /**
  2. * @fileoverview Disallow the use of process.exit()
  3. * @author Nicholas C. Zakas
  4. * @deprecated in ESLint v7.0.0
  5. */
  6. "use strict";
  7. //------------------------------------------------------------------------------
  8. // Rule Definition
  9. //------------------------------------------------------------------------------
  10. /** @type {import('../shared/types').Rule} */
  11. module.exports = {
  12. meta: {
  13. deprecated: true,
  14. replacedBy: [],
  15. type: "suggestion",
  16. docs: {
  17. description: "Disallow the use of `process.exit()`",
  18. recommended: false,
  19. url: "https://eslint.org/docs/latest/rules/no-process-exit"
  20. },
  21. schema: [],
  22. messages: {
  23. noProcessExit: "Don't use process.exit(); throw an error instead."
  24. }
  25. },
  26. create(context) {
  27. //--------------------------------------------------------------------------
  28. // Public
  29. //--------------------------------------------------------------------------
  30. return {
  31. "CallExpression > MemberExpression.callee[object.name = 'process'][property.name = 'exit']"(node) {
  32. context.report({ node: node.parent, messageId: "noProcessExit" });
  33. }
  34. };
  35. }
  36. };