summaryrefslogtreecommitdiff
path: root/cli/tools/fmt.rs
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2024-09-19 02:25:48 -0700
committerGitHub <noreply@github.com>2024-09-19 11:25:48 +0200
commitbb45446fa763b077f705971ca091008febab0794 (patch)
tree5f448cfe62b2656b4d575b7460b72b7064be5e7b /cli/tools/fmt.rs
parent68065351dfeea5cb4c1ea630b02ae7455d416ed9 (diff)
fix: don't include extensionless files in file collection for lint & fmt by default (#25721)
When using the `ext` flag, it will still attempt formatting them with the provided extension
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r--cli/tools/fmt.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs
index 3f927545d..a51a2dfc6 100644
--- a/cli/tools/fmt.rs
+++ b/cli/tools/fmt.rs
@@ -221,10 +221,8 @@ fn collect_fmt_files(
files: FilePatterns,
) -> Result<Vec<PathBuf>, AnyError> {
FileCollector::new(|e| {
- cli_options.ext_flag().as_ref().is_some_and(|ext| {
- is_supported_ext_fmt(Path::new(&format!("placeholder.{ext}")))
- }) || is_supported_ext_fmt(e.path)
- || e.path.extension().is_none()
+ is_supported_ext_fmt(e.path)
+ || (e.path.extension().is_none() && cli_options.ext_flag().is_some())
})
.ignore_git_folder()
.ignore_node_modules()