mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
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
This commit is contained in:
parent
68065351df
commit
bb45446fa7
4 changed files with 14 additions and 8 deletions
|
@ -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()
|
||||
|
|
|
@ -430,10 +430,8 @@ fn collect_lint_files(
|
|||
files: FilePatterns,
|
||||
) -> Result<Vec<PathBuf>, AnyError> {
|
||||
FileCollector::new(|e| {
|
||||
cli_options.ext_flag().as_ref().is_some_and(|ext| {
|
||||
is_script_ext(Path::new(&format!("placeholder.{ext}")))
|
||||
}) || is_script_ext(e.path)
|
||||
|| e.path.extension().is_none()
|
||||
is_script_ext(e.path)
|
||||
|| (e.path.extension().is_none() && cli_options.ext_flag().is_some())
|
||||
})
|
||||
.ignore_git_folder()
|
||||
.ignore_node_modules()
|
||||
|
|
|
@ -12,6 +12,11 @@
|
|||
},
|
||||
"extensionless": {
|
||||
"args": "fmt extensionless",
|
||||
"output": "error: No target files found.\n",
|
||||
"exitCode": 1
|
||||
},
|
||||
"extensionless_with_flag": {
|
||||
"args": "fmt --ext=ts extensionless",
|
||||
"output": "Checked 1 file\n"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,11 @@
|
|||
},
|
||||
"extensionless": {
|
||||
"args": "lint extensionless",
|
||||
"output": "error: No target files found.\n",
|
||||
"exitCode": 1
|
||||
},
|
||||
"extensionless_with_flag": {
|
||||
"args": "lint --ext=ts extensionless",
|
||||
"output": "Checked 1 file\n"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue