Enable no-process-exit ESLint rule (#11025)

This commit is contained in:
Huáng Jùnliàng 2020-01-19 18:48:47 -05:00 committed by Nicolò Ribaudo
parent 341964bd4e
commit facfd4d8a1
5 changed files with 14 additions and 16 deletions

View File

@ -34,7 +34,7 @@ module.exports = {
"no-inner-declarations": "off", "no-inner-declarations": "off",
"no-labels": "off", "no-labels": "off",
"no-loop-func": "off", "no-loop-func": "off",
"no-process-exit": "off", "no-process-exit": "error",
"no-return-assign": "off", "no-return-assign": "off",
"no-shadow": "off", "no-shadow": "off",
"no-underscore-dangle": "off", "no-underscore-dangle": "off",

View File

@ -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( const newData = generateData(
environments, environments,
require(`./data/${target}-features`) require(`./data/${target}-features`)
@ -305,11 +305,10 @@ const generateData = (environments, features) => {
"The newly generated plugin/built-in data does not match the current " + "The newly generated plugin/built-in data does not match the current " +
"files. Re-run `npm run build-data`." "files. Re-run `npm run build-data`."
); );
process.exit(1); process.exitCode = 1;
break;
} }
} else {
process.exit(0);
}
fs.writeFileSync(dataPath, `${JSON.stringify(newData, null, 2)}\n`); fs.writeFileSync(dataPath, `${JSON.stringify(newData, null, 2)}\n`);
}); }
}

View File

@ -92,7 +92,7 @@ getV8Flags(function(err, v8Flags) {
if (signal) { if (signal) {
process.kill(process.pid, signal); process.kill(process.pid, signal);
} else { } else {
process.exit(code); process.exitCode = code;
} }
}); });
}); });

View File

@ -7,10 +7,9 @@ var fs = require("fs");
var filename = process.argv[2]; var filename = process.argv[2];
if (!filename) { if (!filename) {
console.error("no filename specified"); console.error("no filename specified");
process.exit(0); } else {
var file = fs.readFileSync(filename, "utf8");
var ast = parser.parse(file);
console.log(JSON.stringify(ast, null, " "));
} }
var file = fs.readFileSync(filename, "utf8");
var ast = parser.parse(file);
console.log(JSON.stringify(ast, null, " "));

View File

@ -108,4 +108,4 @@ console.log("Cleaning up");
fs.removeSync(tempFolderPath); fs.removeSync(tempFolderPath);
fs.removeSync(packPath); fs.removeSync(packPath);
process.exit(errorOccurred ? 1 : 0); process.exitCode = errorOccurred ? 1 : 0;