Exits the process
This is how the comment reads inline, under the flagged line.
Why it matters
Exiting deep in a call stack skips cleanup, loses buffered logs and makes the code impossible to reuse or test.
What to do
Throw an error and let the entry point decide the exit code.
Examples
if (!cfg) process.exit(1);
if (!cfg) throw new Error("missing config");What it catches
It reads a pattern on each line, aware of strings and comments. Languages: TypeScript and JavaScript, Python. Scope: Shipped code only. These cases are the rule's own tests: the first set must be flagged and the second must not.
Flagged
process.exit(1);
Left alone
src/cli.ts
process.exit(1);
src/app.py
sys.exit(main(sys.argv[1:]))
Research
`process.exit` or `sys.exit` in library code. It skips cleanup, loses buffered logs and makes the code hard to reuse or test.
- no outside source yet
Turn it off or change it
In a config file for the CLI, or in the API's rules field:
{
"rules": {
"disable": [
"exit-in-library"
],
"severity": {
"exit-in-library": "medium"
}
}
}
process.exitkills the whole process from library code.