From a0b687235907ce91358677353c00f575548313b4 Mon Sep 17 00:00:00 2001 From: nokazn <41154684+nokazn@users.noreply.github.com> Date: Thu, 4 Jan 2024 10:43:17 +0900 Subject: fix(cli): respect `exclude` option for `deno check` command (#21779) This PR fixes #21658. - `check` subcommand sees `exclude` option in `deno.json`. When some paths passed with `check` command listed in `exclude`, they are ignored. - When some files are listed in `exclude` and imported indirectly among module graph, they are checked. --- cli/args/mod.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'cli/args') diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 6366ce260..dd9ae36e3 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -311,6 +311,23 @@ fn resolve_fmt_options( options } +#[derive(Clone, Debug, Default)] +pub struct CheckOptions { + pub exclude: Vec, +} + +impl CheckOptions { + pub fn resolve( + maybe_files_config: Option, + ) -> Result { + Ok(Self { + exclude: expand_globs( + maybe_files_config.map(|c| c.exclude).unwrap_or_default(), + )?, + }) + } +} + #[derive(Clone)] pub struct TestOptions { pub files: FilesConfig, @@ -1182,6 +1199,16 @@ impl CliOptions { LintOptions::resolve(maybe_lint_config, Some(lint_flags)) } + pub fn resolve_check_options(&self) -> Result { + let maybe_files_config = if let Some(config_file) = &self.maybe_config_file + { + config_file.to_files_config()? + } else { + None + }; + CheckOptions::resolve(maybe_files_config) + } + pub fn resolve_test_options( &self, test_flags: TestFlags, -- cgit v1.2.3