summaryrefslogtreecommitdiff
path: root/cli/args/mod.rs
diff options
context:
space:
mode:
authornokazn <41154684+nokazn@users.noreply.github.com>2024-01-04 10:43:17 +0900
committerGitHub <noreply@github.com>2024-01-03 20:43:17 -0500
commita0b687235907ce91358677353c00f575548313b4 (patch)
tree5a91d08d997ac7226208f3a24211fef9ef1123ef /cli/args/mod.rs
parent00970daea2245bf4af6b3ee21d0e522fec5638b8 (diff)
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.
Diffstat (limited to 'cli/args/mod.rs')
-rw-r--r--cli/args/mod.rs27
1 files changed, 27 insertions, 0 deletions
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<PathBuf>,
+}
+
+impl CheckOptions {
+ pub fn resolve(
+ maybe_files_config: Option<FilesConfig>,
+ ) -> Result<Self, AnyError> {
+ 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<CheckOptions, AnyError> {
+ 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,