node/process-exit-as-throw

May 3, 2019 ยท View on GitHub

make process.exit() expressions the same code path as throw

  • โญ๏ธ This rule is included in plugin:node/recommended preset.

๐Ÿ“– Rule Details

function foo(a) {
    if (a) {
        return new Bar();
    } else {
        process.exit(1);
    }
}

ESLint does not address process.exit() as stop in code path analysis, then consistent-return rule will warn the above code.

If you turn this rule on, ESLint comes to address process.exit() as throw in code path analysis. So, above code will get expected code path.

This rule itself never warn code.

๐Ÿ”Ž Implementation