Description
The no-core-error-then-process-exit ESLint rule's autofix converts core.error(msg); process.exit(nonzero) to core.setFailed(msg); return;. This is not control-flow equivalent: return exits only the enclosing function, while process.exit aborts the process entirely. In value-returning helpers like requireEnvVar and loadGatewayContext in convert_gateway_config_shared.cjs, the autofix would let callers continue with bad/undefined state.
Suggested Changes
- Fix the autofix to use
process.exit(1) after core.setFailed() OR suppress the autofix for functions that have callers
- Alternatively, gate the autofix to only apply in top-level script contexts (not inside helper functions)
- Add test cases for the helper-function pattern
Files Affected
actions/setup/js/eslint-factory/rules/no-core-error-then-process-exit.ts (rule implementation)
actions/setup/js/eslint-factory/rules/no-core-error-then-process-exit.test.ts (tests)
- Affected sites:
convert_gateway_config_shared.cjs (requireEnvVar:45-52, loadGatewayContext:66-72)
Success Criteria
- Autofix generates control-flow-equivalent code
- Helper functions with return values are excluded from unsafe autofix
- New test cases cover helper-function pattern
Source
Extracted from ESLint Refiner Report #46543
Priority
High — Current autofix introduces latent bugs (execution continues with bad state)
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 40.8 AIC · ⌖ 6.1 AIC · ⊞ 7K · ◷
Description
The
no-core-error-then-process-exitESLint rule's autofix convertscore.error(msg); process.exit(nonzero)tocore.setFailed(msg); return;. This is not control-flow equivalent:returnexits only the enclosing function, whileprocess.exitaborts the process entirely. In value-returning helpers likerequireEnvVarandloadGatewayContextinconvert_gateway_config_shared.cjs, the autofix would let callers continue with bad/undefined state.Suggested Changes
process.exit(1)aftercore.setFailed()OR suppress the autofix for functions that have callersFiles Affected
actions/setup/js/eslint-factory/rules/no-core-error-then-process-exit.ts(rule implementation)actions/setup/js/eslint-factory/rules/no-core-error-then-process-exit.test.ts(tests)convert_gateway_config_shared.cjs(requireEnvVar:45-52, loadGatewayContext:66-72)Success Criteria
Source
Extracted from ESLint Refiner Report #46543
Priority
High — Current autofix introduces latent bugs (execution continues with bad state)