Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable no-process-exit #11025

Merged
merged 1 commit into from Jan 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion eslint/babel-eslint-config-internal/index.js
Expand Up @@ -34,7 +34,7 @@ module.exports = {
"no-inner-declarations": "off",
"no-labels": "off",
"no-loop-func": "off",
"no-process-exit": "off",
"no-process-exit": "error",
"no-return-assign": "off",
"no-shadow": "off",
"no-underscore-dangle": "off",
Expand Down
13 changes: 6 additions & 7 deletions packages/babel-compat-data/scripts/build-data.js
Expand Up @@ -290,7 +290,7 @@ const generateData = (environments, features) => {
});
};

["plugin", "corejs2-built-in"].forEach(target => {
for (const target of ["plugin", "corejs2-built-in"]) {
const newData = generateData(
environments,
require(`./data/${target}-features`)
Expand All @@ -305,11 +305,10 @@ const generateData = (environments, features) => {
"The newly generated plugin/built-in data does not match the current " +
"files. Re-run `npm run build-data`."
);
process.exit(1);
process.exitCode = 1;
break;
}

process.exit(0);
Copy link
Contributor Author

@JLHwung JLHwung Jan 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rather a bug because when --check is provided, it will still exit after checking only "plugin" data. Removed after refactor. So it can continue checking corejs2-builtin-in after the first check succeeds.

} else {
fs.writeFileSync(dataPath, `${JSON.stringify(newData, null, 2)}\n`);
}

fs.writeFileSync(dataPath, `${JSON.stringify(newData, null, 2)}\n`);
});
}
2 changes: 1 addition & 1 deletion packages/babel-node/src/babel-node.js
Expand Up @@ -92,7 +92,7 @@ getV8Flags(function(err, v8Flags) {
if (signal) {
process.kill(process.pid, signal);
} else {
process.exit(code);
process.exitCode = code;
Copy link
Contributor Author

@JLHwung JLHwung Jan 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node.js will terminate when all exit listeners are executed, so we don't need to call process.exit again in the listener.

}
});
});
Expand Down
11 changes: 5 additions & 6 deletions packages/babel-parser/bin/babel-parser.js
Expand Up @@ -7,10 +7,9 @@ var fs = require("fs");
var filename = process.argv[2];
if (!filename) {
console.error("no filename specified");
process.exit(0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process.exit(0) is unnecessary after refactor.

}

var file = fs.readFileSync(filename, "utf8");
var ast = parser.parse(file);
} else {
var file = fs.readFileSync(filename, "utf8");
var ast = parser.parse(file);

console.log(JSON.stringify(ast, null, " "));
console.log(JSON.stringify(ast, null, " "));
}
2 changes: 1 addition & 1 deletion packages/babel-preset-env/scripts/smoke-test.js
Expand Up @@ -108,4 +108,4 @@ console.log("Cleaning up");
fs.removeSync(tempFolderPath);
fs.removeSync(packPath);

process.exit(errorOccurred ? 1 : 0);
process.exitCode = errorOccurred ? 1 : 0;