For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt, and this page is available as Markdown at https://rslint.rs/rules/node/no-process-exit.md.
close

no-process-exit

Added in v0.9.3

Configuration

PresetConfigured Value
✅ nodePlugin.configs.recommended"error"
✅ nodePlugin.configs.recommendedModule"error"
✅ nodePlugin.configs.recommendedScript"error"
rslint.config.ts
import { defineConfig, nodePlugin } from '@rslint/core';

export default defineConfig([
  nodePlugin.configs.recommended,
  {
    rules: {
      'node/no-process-exit': 'error',
    },
  },
]);

Rule Details

Disallows the use of process.exit().

The process.exit() method in Node.js is used to force the process to exit as quickly as possible even if there are still asynchronous operations pending that have not yet completed fully, including I/O operations to process.stdout and process.stderr.

In most cases, it is not necessary to explicitly call process.exit(). The Node.js process will exit on its own if there is no additional work pending in the event loop. Calling process.exit() will force the process to exit as quickly as possible even if there are still asynchronous operations pending.

Examples of incorrect code for this rule:

process.exit(1);
process.exit(0);

Examples of correct code for this rule:

throw new Error("an error occurred");

Original Documentation