no-process-exit

March 27, 2026 Β· View on GitHub

πŸ“ Disallow process.exit().

πŸ’Ό This rule is enabled in the following configs: βœ… recommended, β˜‘οΈ unopinionated.

This rule is an extension to ESLint's no-process-exit rule, that allows process.exit() to be called in files that start with a hashbang β†’ #!/usr/bin/env node. It also allows process.exit() to be called in process.on('<event>', func) event handlers and in files that imports worker_threads.

Examples

// ❌
process.exit(0);

// βœ…
#!/usr/bin/env node
process.exit(0);
// βœ…
process.on('SIGINT', () => {
	console.log('Got SIGINT');
	process.exit(1);
});
// βœ…
import workerThreads from 'node:worker_threads';

try {
	// Do something…
	process.exit(0);
} catch (_) {
	process.exit(1);
}