unicorn/no-process-exit
eslint-plugin-unicorn
No autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-process-exit": "error",
},
},
];process.exit(0);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);
}Examples from the ESLint documentation.
unicorn/no-process-exit
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-process-exit": "error",
},
},
];unicorn/no-process-exit
unicorn plugin · restriction
{
"rules": {
"unicorn/no-process-exit": "error"
}
}nursery/noProcessExit
nursery · since 2.6.0
{
"linter": {
"rules": {
"nursery": {
"noProcessExit": "error"
}
}
}
}Prefer globalThis over window, self, and global.
Disallow unnecessary .toArray() on iterators.
Prefer using the String.raw tag to avoid escaping \.
Prefer top-level await over top-level promises and async function calls.