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/lint | |
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/lint')
-rw-r--r-- | cli/tools/lint/mod.rs | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/cli/tools/lint/mod.rs b/cli/tools/lint/mod.rs index fec664784..03f5b8676 100644 --- a/cli/tools/lint/mod.rs +++ b/cli/tools/lint/mod.rs @@ -34,6 +34,7 @@ use std::path::Path; use std::path::PathBuf; use std::sync::Arc; +use crate::args::CliOptions; use crate::args::Flags; use crate::args::LintFlags; use crate::args::LintOptions; @@ -78,15 +79,15 @@ pub async fn lint(flags: Flags, lint_flags: LintFlags) -> Result<(), AnyError> { let factory = CliFactory::from_flags(flags)?; let cli_options = factory.cli_options(); let lint_options = cli_options.resolve_lint_options(lint_flags)?; - let files = collect_lint_files(lint_options.files.clone()).and_then( - |files| { - if files.is_empty() { - Err(generic_error("No target files found.")) - } else { - Ok(files) - } - }, - )?; + let files = + collect_lint_files(cli_options, lint_options.files.clone()) + .and_then(|files| { + if files.is_empty() { + Err(generic_error("No target files found.")) + } else { + Ok(files) + } + })?; _ = watcher_communicator.watch_paths(files.clone()); let lint_paths = if let Some(paths) = changed_paths { @@ -133,8 +134,8 @@ pub async fn lint(flags: Flags, lint_flags: LintFlags) -> Result<(), AnyError> { reporter_lock.lock().close(1); success } else { - let target_files = - collect_lint_files(files.clone()).and_then(|files| { + let target_files = collect_lint_files(cli_options, files.clone()) + .and_then(|files| { if files.is_empty() { Err(generic_error("No target files found.")) } else { @@ -267,11 +268,14 @@ async fn lint_files( Ok(!has_error.is_raised()) } -fn collect_lint_files(files: FilePatterns) -> Result<Vec<PathBuf>, AnyError> { +fn collect_lint_files( + cli_options: &CliOptions, + files: FilePatterns, +) -> Result<Vec<PathBuf>, AnyError> { FileCollector::new(|e| is_script_ext(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) } |