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);
}