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/tests/testdata/check/exclude_option/deno.exclude_dir.json | 5 +++++ cli/tests/testdata/check/exclude_option/deno.exclude_glob.json | 5 +++++ cli/tests/testdata/check/exclude_option/deno.json | 3 +++ cli/tests/testdata/check/exclude_option/exclude_option.ts.error.out | 4 ++++ cli/tests/testdata/check/exclude_option/ignored/index.ts | 1 + cli/tests/testdata/check/exclude_option/index.ts | 5 +++++ 6 files changed, 23 insertions(+) create mode 100644 cli/tests/testdata/check/exclude_option/deno.exclude_dir.json create mode 100644 cli/tests/testdata/check/exclude_option/deno.exclude_glob.json create mode 100644 cli/tests/testdata/check/exclude_option/deno.json create mode 100644 cli/tests/testdata/check/exclude_option/exclude_option.ts.error.out create mode 100644 cli/tests/testdata/check/exclude_option/ignored/index.ts create mode 100644 cli/tests/testdata/check/exclude_option/index.ts (limited to 'cli/tests/testdata') diff --git a/cli/tests/testdata/check/exclude_option/deno.exclude_dir.json b/cli/tests/testdata/check/exclude_option/deno.exclude_dir.json new file mode 100644 index 000000000..2019f8953 --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/deno.exclude_dir.json @@ -0,0 +1,5 @@ +{ + "exclude": [ + "ignored" + ] +} diff --git a/cli/tests/testdata/check/exclude_option/deno.exclude_glob.json b/cli/tests/testdata/check/exclude_option/deno.exclude_glob.json new file mode 100644 index 000000000..1d203ba08 --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/deno.exclude_glob.json @@ -0,0 +1,5 @@ +{ + "exclude": [ + "ignored/**/*" + ] +} diff --git a/cli/tests/testdata/check/exclude_option/deno.json b/cli/tests/testdata/check/exclude_option/deno.json new file mode 100644 index 000000000..a9eca74ca --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/deno.json @@ -0,0 +1,3 @@ +{ + "exclude": [] +} diff --git a/cli/tests/testdata/check/exclude_option/exclude_option.ts.error.out b/cli/tests/testdata/check/exclude_option/exclude_option.ts.error.out new file mode 100644 index 000000000..abd1c1258 --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/exclude_option.ts.error.out @@ -0,0 +1,4 @@ +error: TS2304 [ERROR]: Cannot find name 'nothing'. +export { nothing }; + ~~~~~~~ + at [WILDCARD] diff --git a/cli/tests/testdata/check/exclude_option/ignored/index.ts b/cli/tests/testdata/check/exclude_option/ignored/index.ts new file mode 100644 index 000000000..0419cf073 --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/ignored/index.ts @@ -0,0 +1 @@ +export { nothing }; diff --git a/cli/tests/testdata/check/exclude_option/index.ts b/cli/tests/testdata/check/exclude_option/index.ts new file mode 100644 index 000000000..8335ca3a2 --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/index.ts @@ -0,0 +1,5 @@ +import { nothing } from "./ignored/index.ts"; + +const foo = 1; + +export { foo, nothing }; -- cgit v1.2.3