summaryrefslogtreecommitdiff
path: root/cli/tools/fmt.rs
diff options
context:
space:
mode:
authorYusuke Tanaka <tanaka.yusuke@stadium.co.jp>2021-02-19 21:18:16 +0900
committerGitHub <noreply@github.com>2021-02-19 07:18:16 -0500
commit91881b7cd362eed7bf28e09ad2ca0d40a36f1d9b (patch)
tree0ebd43c4958980485ad90565f06a69f4e732a6d4 /cli/tools/fmt.rs
parent555595e6d02d1fc1adb535df074d258389fab509 (diff)
fix: lint and fmt error if no target files are found (#9527)
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r--cli/tools/fmt.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs
index d4002984a..6afcb90af 100644
--- a/cli/tools/fmt.rs
+++ b/cli/tools/fmt.rs
@@ -37,7 +37,13 @@ pub async fn format(
) -> Result<(), AnyError> {
let target_file_resolver = || {
// collect the files that are to be formatted
- collect_files(&args, &ignore, is_supported_ext_fmt)
+ collect_files(&args, &ignore, is_supported_ext_fmt).and_then(|files| {
+ if files.is_empty() {
+ Err(generic_error("No target files found."))
+ } else {
+ Ok(files)
+ }
+ })
};
let operation = |paths: Vec<PathBuf>| {
let config = get_typescript_config();