refactor: rename `resolveConfig` with `logResolvedConfigPathOrDie`

master
ikatyang 2017-09-07 10:23:40 +08:00
parent d139006c98
commit 18782f77cb
2 changed files with 4 additions and 4 deletions

View File

@ -130,12 +130,12 @@ function handleError(filename, e) {
process.exitCode = 2;
}
function resolveConfig(filePath) {
function logResolvedConfigPathOrDie(filePath) {
const configFile = resolver.resolveConfigFile.sync(filePath);
if (configFile) {
console.log(path.relative(process.cwd(), configFile));
} else {
process.exitCode = 1;
process.exit(1);
}
}
@ -393,7 +393,7 @@ function formatFiles(argv) {
}
module.exports = {
resolveConfig,
logResolvedConfigPathOrDie,
format,
formatStdin,
formatFiles

View File

@ -28,7 +28,7 @@ function run(args) {
const useStdin = argv["stdin"] || (!hasFilePatterns && !process.stdin.isTTY);
if (argv["find-config-path"]) {
util.resolveConfig(argv["find-config-path"]);
util.logResolvedConfigPathOrDie(argv["find-config-path"]);
} else if (useStdin) {
util.formatStdin(argv);
} else if (hasFilePatterns) {