diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-27 14:25:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 14:25:39 -0400 |
commit | 68fecc6de4b2e6556adeb2730798bf42017c4be6 (patch) | |
tree | ed7b7644221e4a53f30df3e33d41e7994e10b169 /cli/tools/fmt.rs | |
parent | 0e4d1cb5f9a3645f6da480b2b8540568fa69d675 (diff) |
fix: less aggressive vendor folder ignoring (#23100)
This is slightly breaking as some users want the `vendor` folder
excluded and may not have that specified in their deno.json.
Closes #22833
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r-- | cli/tools/fmt.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs index 241648d98..b16639f99 100644 --- a/cli/tools/fmt.rs +++ b/cli/tools/fmt.rs @@ -71,8 +71,8 @@ pub async fn format(flags: Flags, fmt_flags: FmtFlags) -> Result<(), AnyError> { let factory = CliFactory::from_flags(flags)?; let cli_options = factory.cli_options(); let fmt_options = cli_options.resolve_fmt_options(fmt_flags)?; - let files = - collect_fmt_files(fmt_options.files.clone()).and_then(|files| { + let files = collect_fmt_files(cli_options, fmt_options.files.clone()) + .and_then(|files| { if files.is_empty() { Err(generic_error("No target files found.")) } else { @@ -116,8 +116,8 @@ pub async fn format(flags: Flags, fmt_flags: FmtFlags) -> Result<(), AnyError> { let factory = CliFactory::from_flags(flags)?; let cli_options = factory.cli_options(); let fmt_options = cli_options.resolve_fmt_options(fmt_flags)?; - let files = - collect_fmt_files(fmt_options.files.clone()).and_then(|files| { + let files = collect_fmt_files(cli_options, fmt_options.files.clone()) + .and_then(|files| { if files.is_empty() { Err(generic_error("No target files found.")) } else { @@ -153,11 +153,14 @@ async fn format_files( Ok(()) } -fn collect_fmt_files(files: FilePatterns) -> Result<Vec<PathBuf>, AnyError> { +fn collect_fmt_files( + cli_options: &CliOptions, + files: FilePatterns, +) -> Result<Vec<PathBuf>, AnyError> { FileCollector::new(|e| is_supported_ext_fmt(e.path)) .ignore_git_folder() .ignore_node_modules() - .ignore_vendor_folder() + .set_vendor_folder(cli_options.vendor_dir_path().map(ToOwned::to_owned)) .collect_file_patterns(files) } |