Skip to content

unicorn/no-process-exit Restriction

🚧 An auto-fix is still under development.

What it does

Disallow process.exit().

Why is this bad?

Only use process.exit() in CLI apps. Throw an error instead.

Example

Examples of incorrect code for this rule:

javascript
if (problem) process.exit(1);

Examples of correct code for this rule:

javascript
if (problem) throw new Error("message");
#!/usr/bin/env node
if (problem) process.exit(1);

References

Released under the MIT License.