diff options
author | Bartek Iwańczuk <biwanczuk@gmail.com> | 2023-05-23 03:39:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-23 03:39:59 +0200 |
commit | 5874fc3d0aaf1b0453fb916656187503d8619ccd (patch) | |
tree | 16bdea5734546c04a95a119e139542f83bed2d8a /cli | |
parent | bb37dfb5b79c0e5ae18d34f01313cb1f39d7a2dd (diff) |
feat: add support for globs in the config file and CLI arguments for files (#19102)
Follow up to https://github.com/denoland/deno/pull/19084.
This commit adds support for globs in the configuration file as well
as CLI arguments for files.
With this change users can now use glob syntax for "include" and
"exclude" fields, like so:
```json
{
"lint": {
"include": [
"directory/test*.ts",
"other_dir/"
],
"exclude": [
"other_dir/foo*.ts",
"nested/nested2/*"
]
},
"test": {
"include": [
"data/test*.ts",
"nested/",
"tests/test[1-9].ts"
],
"exclude": [
"nested/foo?.ts",
"nested/nested2/*"
]
}
}
```
Or in CLI args like so:
```
// notice quotes here; these values will be passed to Deno verbatim
// and deno will perform glob expansion
$ deno fmt --ignore="data/*.ts"
$ deno lint "data/**/*.ts"
```
Closes https://github.com/denoland/deno/issues/17971
Closes https://github.com/denoland/deno/issues/6365
Diffstat (limited to 'cli')
49 files changed, 524 insertions, 34 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 59cabd915..4c6db695f 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -75,6 +75,7 @@ fancy-regex = "=0.10.0" fastwebsockets.workspace = true flate2.workspace = true fs3.workspace = true +glob = "0.3.1" http.workspace = true hyper.workspace = true import_map = "=0.15.0" diff --git a/cli/args/config_file.rs b/cli/args/config_file.rs index c2f02e5c1..61f7778d9 100644 --- a/cli/args/config_file.rs +++ b/cli/args/config_file.rs @@ -299,24 +299,19 @@ impl SerializedFilesConfig { self, config_file_specifier: &ModuleSpecifier, ) -> Result<FilesConfig, AnyError> { - let config_dir = specifier_parent(config_file_specifier); + let config_dir = + specifier_to_file_path(&specifier_parent(config_file_specifier))?; Ok(FilesConfig { include: self .include .into_iter() - .map(|p| { - let url = config_dir.join(&p)?; - specifier_to_file_path(&url) - }) - .collect::<Result<Vec<_>, _>>()?, + .map(|p| config_dir.join(p)) + .collect::<Vec<_>>(), exclude: self .exclude .into_iter() - .map(|p| { - let url = config_dir.join(&p)?; - specifier_to_file_path(&url) - }) - .collect::<Result<Vec<_>, _>>()?, + .map(|p| config_dir.join(p)) + .collect::<Vec<_>>(), }) } diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 5dd723eaf..513d4b39e 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -138,7 +138,7 @@ impl BenchOptions { files: resolve_files( maybe_bench_config.map(|c| c.files), Some(bench_flags.files), - ), + )?, filter: bench_flags.filter, json: bench_flags.json, no_run: bench_flags.no_run, @@ -183,7 +183,7 @@ impl FmtOptions { files: resolve_files( maybe_config_files, maybe_fmt_flags.map(|f| f.files), - ), + )?, }) } } @@ -253,7 +253,7 @@ impl TestOptions { files: resolve_files( maybe_test_config.map(|c| c.files), Some(test_flags.files), - ), + )?, allow_none: test_flags.allow_none, concurrent_jobs: test_flags .concurrent_jobs @@ -348,7 +348,7 @@ impl LintOptions { Ok(Self { reporter_kind: maybe_reporter_kind.unwrap_or_default(), is_stdin, - files: resolve_files(maybe_config_files, Some(maybe_file_flags)), + files: resolve_files(maybe_config_files, Some(maybe_file_flags))?, rules: resolve_lint_rules_options( maybe_config_rules, maybe_rules_tags, @@ -1323,13 +1323,46 @@ impl StorageKeyResolver { } } +fn expand_globs(paths: &[PathBuf]) -> Result<Vec<PathBuf>, AnyError> { + let mut new_paths = vec![]; + for path in paths { + let path_str = path.to_string_lossy(); + if path_str.chars().any(|c| matches!(c, '*' | '?')) { + // Escape brackets - we currently don't support them, because with introduction + // of glob expansion paths like "pages/[id].ts" would suddenly start giving + // wrong results. We might want to revisit that in the future. + let escaped_path_str = path_str.replace('[', "[[]").replace(']', "[]]"); + let globbed_paths = glob::glob_with( + &escaped_path_str, + // Matches what `deno_task_shell` does + glob::MatchOptions { + // false because it should work the same way on case insensitive file systems + case_sensitive: false, + // true because it copies what sh does + require_literal_separator: true, + // true because it copies with sh does—these files are considered "hidden" + require_literal_leading_dot: true, + }, + )?; + + for globbed_path_result in globbed_paths { + new_paths.push(globbed_path_result?); + } + } else { + new_paths.push(path.clone()); + } + } + + Ok(new_paths) +} + /// Collect included and ignored files. CLI flags take precedence /// over config file, i.e. if there's `files.ignore` in config file /// and `--ignore` CLI flag, only the flag value is taken into account. fn resolve_files( maybe_files_config: Option<FilesConfig>, maybe_file_flags: Option<FileFlags>, -) -> FilesConfig { +) -> Result<FilesConfig, AnyError> { let mut result = maybe_files_config.unwrap_or_default(); if let Some(file_flags) = maybe_file_flags { if !file_flags.include.is_empty() { @@ -1339,7 +1372,16 @@ fn resolve_files( result.exclude = file_flags.ignore; } } - result + // Now expand globs if there are any + if !result.include.is_empty() { + result.include = expand_globs(&result.include)?; + } + + if !result.exclude.is_empty() { + result.exclude = expand_globs(&result.exclude)?; + } + + Ok(result) } /// Resolves the no_prompt value based on the cli flags and environment. @@ -1365,6 +1407,7 @@ pub fn npm_pkg_req_ref_to_binary_command( #[cfg(test)] mod test { use super::*; + use pretty_assertions::assert_eq; #[cfg(not(windows))] #[test] @@ -1520,4 +1563,71 @@ mod test { let resolver = StorageKeyResolver::empty(); assert_eq!(resolver.resolve_storage_key(&specifier), None); } + + #[test] + fn resolve_files_test() { + use test_util::TempDir; + let temp_dir = TempDir::new(); + + temp_dir.create_dir_all("data"); + temp_dir.create_dir_all("nested"); + temp_dir.create_dir_all("nested/foo"); + temp_dir.create_dir_all("nested/fizz"); + temp_dir.create_dir_all("pages"); + + temp_dir.write("data/tes.ts", ""); + temp_dir.write("data/test1.js", ""); + temp_dir.write("data/test1.ts", ""); + temp_dir.write("data/test12.ts", ""); + + temp_dir.write("nested/foo/foo.ts", ""); + temp_dir.write("nested/foo/bar.ts", ""); + temp_dir.write("nested/foo/fizz.ts", ""); + temp_dir.write("nested/foo/bazz.ts", ""); + + temp_dir.write("nested/fizz/foo.ts", ""); + temp_dir.write("nested/fizz/bar.ts", ""); + temp_dir.write("nested/fizz/fizz.ts", ""); + temp_dir.write("nested/fizz/bazz.ts", ""); + + temp_dir.write("pages/[id].ts", ""); + + let resolved_files = resolve_files( + Some(FilesConfig { + include: vec![ + temp_dir.path().join("data/test1.?s"), + temp_dir.path().join("nested/foo/*.ts"), + temp_dir.path().join("nested/fizz/*.ts"), + temp_dir.path().join("pages/[id].ts"), + ], + exclude: vec![temp_dir.path().join("nested/**/*bazz.ts")], + }), + None, + ) + .unwrap(); + + assert_eq!( + resolved_files.include, + vec![ + temp_dir.path().join("data/test1.js"), + temp_dir.path().join("data/test1.ts"), + temp_dir.path().join("nested/foo/bar.ts"), + temp_dir.path().join("nested/foo/bazz.ts"), + temp_dir.path().join("nested/foo/fizz.ts"), + temp_dir.path().join("nested/foo/foo.ts"), + temp_dir.path().join("nested/fizz/bar.ts"), + temp_dir.path().join("nested/fizz/bazz.ts"), + temp_dir.path().join("nested/fizz/fizz.ts"), + temp_dir.path().join("nested/fizz/foo.ts"), + temp_dir.path().join("pages/[id].ts"), + ] + ); + assert_eq!( + resolved_files.exclude, + vec![ + temp_dir.path().join("nested/fizz/bazz.ts"), + temp_dir.path().join("nested/foo/bazz.ts"), + ] + ) + } } diff --git a/cli/schemas/config-file.v1.json b/cli/schemas/config-file.v1.json index 99f2b3a79..73723c52b 100644 --- a/cli/schemas/config-file.v1.json +++ b/cli/schemas/config-file.v1.json @@ -225,7 +225,7 @@ }, "exclude": { "type": "array", - "description": "List of files or directories that will be ignored by all other configurations. Requires Deno 1.34 or later.", + "description": "List of files, directories or globs that will be ignored by all other configurations. Requires Deno 1.34 or later.", "items": { "type": "string" } @@ -236,14 +236,14 @@ "properties": { "include": { "type": "array", - "description": "List of files or directories that will be linted.", + "description": "List of files, directories or globs that will be linted.", "items": { "type": "string" } }, "exclude": { "type": "array", - "description": "List of files or directories that will not be linted.", + "description": "List of files, directories or globs that will not be linted.", "items": { "type": "string" } @@ -253,14 +253,14 @@ "properties": { "include": { "type": "array", - "description": "List of files or directories that will be linted.", + "description": "List of files, directories or globs that will be linted.", "items": { "type": "string" } }, "exclude": { "type": "array", - "description": "List of files or directories that will not be linted.", + "description": "List of files, directories or globs that will not be linted.", "items": { "type": "string" } @@ -316,14 +316,14 @@ "properties": { "include": { "type": "array", - "description": "List of files or directories that will be formatted.", + "description": "List of files, directories or globs that will be formatted.", "items": { "type": "string" } }, "exclude": { "type": "array", - "description": "List of files or directories that will not be formatted.", + "description": "List of files, directories or globs that will not be formatted.", "items": { "type": "string" } @@ -333,14 +333,14 @@ "properties": { "include": { "type": "array", - "description": "List of files or directories that will be formatted.", + "description": "List of files, directories or globs that will be formatted.", "items": { "type": "string" } }, "exclude": { "type": "array", - "description": "List of files or directories that will not be formatted.", + "description": "List of files, directories or globs that will not be formatted.", "items": { "type": "string" } @@ -443,14 +443,14 @@ "properties": { "include": { "type": "array", - "description": "List of files or directories that will be searched for tests.", + "description": "List of files, directories or globs that will be searched for tests.", "items": { "type": "string" } }, "exclude": { "type": "array", - "description": "List of files or directories that will not be searched for tests.", + "description": "List of files, directories or globs that will not be searched for tests.", "items": { "type": "string" } @@ -460,14 +460,14 @@ "properties": { "include": { "type": "array", - "description": "List of files or directories that will be searched for tests.", + "description": "List of files, directories or globs that will be searched for tests.", "items": { "type": "string" } }, "exclude": { "type": "array", - "description": "List of files or directories that will not be searched for tests.", + "description": "List of files, directories or globs that will not be searched for tests.", "items": { "type": "string" } @@ -482,14 +482,14 @@ "properties": { "include": { "type": "array", - "description": "List of files or directories that will be searched for benchmarks.", + "description": "List of files, directories or globs that will be searched for benchmarks.", "items": { "type": "string" } }, "exclude": { "type": "array", - "description": "List of files or directories that will not be searched for benchmarks.", + "description": "List of files, directories or globs that will not be searched for benchmarks.", "items": { "type": "string" } @@ -499,14 +499,14 @@ "properties": { "include": { "type": "array", - "description": "List of files or directories that will be searched for benchmarks.", + "description": "List of files, directories or globs that will be searched for benchmarks.", "items": { "type": "string" } }, "exclude": { "type": "array", - "description": "List of files or directories that will not be searched for benchmarks.", + "description": "List of files, directories or globs that will not be searched for benchmarks.", "items": { "type": "string" } diff --git a/cli/tests/integration/fmt_tests.rs b/cli/tests/integration/fmt_tests.rs index e47311cf0..e674f4a52 100644 --- a/cli/tests/integration/fmt_tests.rs +++ b/cli/tests/integration/fmt_tests.rs @@ -2,7 +2,9 @@ use test_util as util; use test_util::TempDir; +use util::assert_contains; use util::TestContext; +use util::TestContextBuilder; #[test] fn fmt_test() { @@ -257,3 +259,93 @@ itest!(fmt_with_malformed_config2 { output: "fmt/fmt_with_malformed_config2.out", exit_code: 1, }); + +#[test] +fn fmt_with_glob_config() { + let context = TestContextBuilder::new().cwd("fmt").build(); + + let cmd_output = context + .new_command() + .args("fmt --check --config deno.glob.json") + .run(); + + cmd_output.assert_exit_code(1); + + let output = cmd_output.combined_output(); + if cfg!(windows) { + assert_contains!(output, r#"glob\nested\fizz\fizz.ts"#); + assert_contains!(output, r#"glob\pages\[id].ts"#); + assert_contains!(output, r#"glob\nested\fizz\bar.ts"#); + assert_contains!(output, r#"glob\nested\foo\foo.ts"#); + assert_contains!(output, r#"glob\data\test1.js"#); + assert_contains!(output, r#"glob\nested\foo\bar.ts"#); + assert_contains!(output, r#"glob\nested\foo\fizz.ts"#); + assert_contains!(output, r#"glob\nested\fizz\foo.ts"#); + assert_contains!(output, r#"glob\data\test1.ts"#); + } else { + assert_contains!(output, "glob/nested/fizz/fizz.ts"); + assert_contains!(output, "glob/pages/[id].ts"); + assert_contains!(output, "glob/nested/fizz/bar.ts"); + assert_contains!(output, "glob/nested/foo/foo.ts"); + assert_contains!(output, "glob/data/test1.js"); + assert_contains!(output, "glob/nested/foo/bar.ts"); + assert_contains!(output, "glob/nested/foo/fizz.ts"); + assert_contains!(output, "glob/nested/fizz/foo.ts"); + assert_contains!(output, "glob/data/test1.ts"); + } + + assert_contains!(output, "Found 9 not formatted files in 9 files"); +} + +#[test] +fn fmt_with_glob_config_and_flags() { + let context = TestContextBuilder::new().cwd("fmt").build(); + + let cmd_output = context + .new_command() + .args("fmt --check --config deno.glob.json --ignore=glob/nested/**/bar.ts") + .run(); + + cmd_output.assert_exit_code(1); + + let output = cmd_output.combined_output(); + if cfg!(windows) { + assert_contains!(output, r#"glob\nested\fizz\fizz.ts"#); + assert_contains!(output, r#"glob\pages\[id].ts"#); + assert_contains!(output, r#"glob\nested\fizz\bazz.ts"#); + assert_contains!(output, r#"glob\nested\foo\foo.ts"#); + assert_contains!(output, r#"glob\data\test1.js"#); + assert_contains!(output, r#"glob\nested\foo\bazz.ts"#); + assert_contains!(output, r#"glob\nested\foo\fizz.ts"#); + assert_contains!(output, r#"glob\nested\fizz\foo.ts"#); + assert_contains!(output, r#"glob\data\test1.ts"#); + } else { + assert_contains!(output, "glob/nested/fizz/fizz.ts"); + assert_contains!(output, "glob/pages/[id].ts"); + assert_contains!(output, "glob/nested/fizz/bazz.ts"); + assert_contains!(output, "glob/nested/foo/foo.ts"); + assert_contains!(output, "glob/data/test1.js"); + assert_contains!(output, "glob/nested/foo/bazz.ts"); + assert_contains!(output, "glob/nested/foo/fizz.ts"); + assert_contains!(output, "glob/nested/fizz/foo.ts"); + assert_contains!(output, "glob/data/test1.ts"); + } + assert_contains!(output, "Found 9 not formatted files in 9 files"); + let cmd_output = context + .new_command() + .args("fmt --check --config deno.glob.json glob/data/test1.?s") + .run(); + + cmd_output.assert_exit_code(1); + + let output = cmd_output.combined_output(); + if cfg!(windows) { + assert_contains!(output, r#"glob\data\test1.js"#); + assert_contains!(output, r#"glob\data\test1.ts"#); + } else { + assert_contains!(output, "glob/data/test1.js"); + assert_contains!(output, "glob/data/test1.ts"); + } + + assert_contains!(output, "Found 2 not formatted files in 2 files"); +} diff --git a/cli/tests/integration/lint_tests.rs b/cli/tests/integration/lint_tests.rs index 8bf35ed8f..6fef3c000 100644 --- a/cli/tests/integration/lint_tests.rs +++ b/cli/tests/integration/lint_tests.rs @@ -1,5 +1,8 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. +use test_util::assert_contains; +use test_util::TestContextBuilder; + itest!(ignore_unexplicit_files { args: "lint --unstable --ignore=./", output_str: Some("error: No target files found.\n"), @@ -114,3 +117,95 @@ itest!(lint_with_malformed_config2 { output: "lint/with_malformed_config2.out", exit_code: 1, }); + +#[test] +fn lint_with_glob_config() { + let context = TestContextBuilder::new().cwd("lint").build(); + + let cmd_output = context + .new_command() + .args("lint --config deno.glob.json") + .run(); + + cmd_output.assert_exit_code(1); + + let output = cmd_output.combined_output(); + if cfg!(windows) { + assert_contains!(output, r#"glob\nested\fizz\fizz.ts:1:10"#); + assert_contains!(output, r#"glob\pages\[id].ts:1:10"#); + assert_contains!(output, r#"glob\nested\fizz\bar.ts:1:10"#); + assert_contains!(output, r#"glob\nested\foo\foo.ts:1:10"#); + assert_contains!(output, r#"glob\data\test1.js:1:10"#); + assert_contains!(output, r#"glob\nested\foo\bar.ts:1:10"#); + assert_contains!(output, r#"glob\nested\foo\fizz.ts:1:10"#); + assert_contains!(output, r#"glob\nested\fizz\foo.ts:1:10"#); + assert_contains!(output, r#"glob\data\test1.ts:1:10"#); + } else { + assert_contains!(output, "glob/nested/fizz/fizz.ts:1:10"); + assert_contains!(output, "glob/pages/[id].ts:1:10"); + assert_contains!(output, "glob/nested/fizz/bar.ts:1:10"); + assert_contains!(output, "glob/nested/foo/foo.ts:1:10"); + assert_contains!(output, "glob/data/test1.js:1:10"); + assert_contains!(output, "glob/nested/foo/bar.ts:1:10"); + assert_contains!(output, "glob/nested/foo/fizz.ts:1:10"); + assert_contains!(output, "glob/nested/fizz/foo.ts:1:10"); + assert_contains!(output, "glob/data/test1.ts:1:10"); + } + assert_contains!(output, "Found 9 problems"); + assert_contains!(output, "Checked 9 files"); +} + +#[test] +fn lint_with_glob_config_and_flags() { + let context = TestContextBuilder::new().cwd("lint").build(); + + let cmd_output = context + .new_command() + .args("lint --config deno.glob.json --ignore=glob/nested/**/bar.ts") + .run(); + + cmd_output.assert_exit_code(1); + + let output = cmd_output.combined_output(); + if cfg!(windows) { + assert_contains!(output, r#"glob\nested\fizz\fizz.ts:1:10"#); + assert_contains!(output, r#"glob\pages\[id].ts:1:10"#); + assert_contains!(output, r#"glob\nested\fizz\bazz.ts:1:10"#); + assert_contains!(output, r#"glob\nested\foo\foo.ts:1:10"#); + assert_contains!(output, r#"glob\data\test1.js:1:10"#); + assert_contains!(output, r#"glob\nested\foo\bazz.ts:1:10"#); + assert_contains!(output, r#"glob\nested\foo\fizz.ts:1:10"#); + assert_contains!(output, r#"glob\nested\fizz\foo.ts:1:10"#); + assert_contains!(output, r#"glob\data\test1.ts:1:10"#); + } else { + assert_contains!(output, "glob/nested/fizz/fizz.ts:1:10"); + assert_contains!(output, "glob/pages/[id].ts:1:10"); + assert_contains!(output, "glob/nested/fizz/bazz.ts:1:10"); + assert_contains!(output, "glob/nested/foo/foo.ts:1:10"); + assert_contains!(output, "glob/data/test1.js:1:10"); + assert_contains!(output, "glob/nested/foo/bazz.ts:1:10"); + assert_contains!(output, "glob/nested/foo/fizz.ts:1:10"); + assert_contains!(output, "glob/nested/fizz/foo.ts:1:10"); + assert_contains!(output, "glob/data/test1.ts:1:10"); + } + assert_contains!(output, "Found 9 problems"); + assert_contains!(output, "Checked 9 files"); + + let cmd_output = context + .new_command() + .args("lint --config deno.glob.json glob/data/test1.?s") + .run(); + + cmd_output.assert_exit_code(1); + + let output = cmd_output.combined_output(); + if cfg!(windows) { + assert_contains!(output, r#"glob\data\test1.js:1:10"#); + assert_contains!(output, r#"glob\data\test1.ts:1:10"#); + } else { + assert_contains!(output, "glob/data/test1.js:1:10"); + assert_contains!(output, "glob/data/test1.ts:1:10"); + } + assert_contains!(output, "Found 2 problems"); + assert_contains!(output, "Checked 2 files"); +} diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs index 04966f4ee..4dd29528f 100644 --- a/cli/tests/integration/test_tests.rs +++ b/cli/tests/integration/test_tests.rs @@ -6,6 +6,7 @@ use util::assert_contains; use util::env_vars_for_npm_tests; use util::wildcard_match; use util::TestContext; +use util::TestContextBuilder; #[test] fn no_color() { @@ -508,3 +509,60 @@ itest!(test_no_lock { cwd: Some("lockfile/basic"), output: "lockfile/basic/test.nolock.out", }); + +#[test] +fn test_with_glob_config() { + let context = TestContextBuilder::new().cwd("test").build(); + + let cmd_output = context + .new_command() + .args("test --config deno.glob.json") + .run(); + + cmd_output.assert_exit_code(0); + + let output = cmd_output.combined_output(); + assert_contains!(output, "glob/nested/fizz/fizz.ts"); + assert_contains!(output, "glob/pages/[id].ts"); + assert_contains!(output, "glob/nested/fizz/bar.ts"); + assert_contains!(output, "glob/nested/foo/foo.ts"); + assert_contains!(output, "glob/data/test1.js"); + assert_contains!(output, "glob/nested/foo/bar.ts"); + assert_contains!(output, "glob/nested/foo/fizz.ts"); + assert_contains!(output, "glob/nested/fizz/foo.ts"); + assert_contains!(output, "glob/data/test1.ts"); +} + +#[test] +fn test_with_glob_config_and_flags() { + let context = TestContextBuilder::new().cwd("test").build(); + + let cmd_output = context + .new_command() + .args("test --config deno.glob.json --ignore=glob/nested/**/bar.ts") + .run(); + + cmd_output.assert_exit_code(0); + + let output = cmd_output.combined_output(); + assert_contains!(output, "glob/nested/fizz/fizz.ts"); + assert_contains!(output, "glob/pages/[id].ts"); + assert_contains!(output, "glob/nested/fizz/bazz.ts"); + assert_contains!(output, "glob/nested/foo/foo.ts"); + assert_contains!(output, "glob/data/test1.js"); + assert_contains!(output, "glob/nested/foo/bazz.ts"); + assert_contains!(output, "glob/nested/foo/fizz.ts"); + assert_contains!(output, "glob/nested/fizz/foo.ts"); + assert_contains!(output, "glob/data/test1.ts"); + + let cmd_output = context + .new_command() + .args("test --config deno.glob.json glob/data/test1.?s") + .run(); + + cmd_output.assert_exit_code(0); + + let output = cmd_output.combined_output(); + assert_contains!(output, "glob/data/test1.js"); + assert_contains!(output, "glob/data/test1.ts"); +} diff --git a/cli/tests/testdata/fmt/deno.glob.json b/cli/tests/testdata/fmt/deno.glob.json new file mode 100644 index 000000000..ff74e9d2b --- /dev/null +++ b/cli/tests/testdata/fmt/deno.glob.json @@ -0,0 +1,11 @@ +{ + "fmt": { + "include": [ + "glob/data/test1.?s", + "glob/nested/foo/*.ts", + "glob/nested/fizz/*.ts", + "glob/pages/[id].ts" + ], + "exclude": ["glob/nested/**/*bazz.ts"] + } +} diff --git a/cli/tests/testdata/fmt/glob/data/tes.ts b/cli/tests/testdata/fmt/glob/data/tes.ts new file mode 100644 index 000000000..0127c4af3 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/data/tes.ts @@ -0,0 +1,3 @@ + function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/fmt/glob/data/test1.js b/cli/tests/testdata/fmt/glob/data/test1.js new file mode 100644 index 000000000..e939e4595 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/data/test1.js @@ -0,0 +1,2 @@ + function foo() { +} diff --git a/cli/tests/testdata/fmt/glob/data/test1.ts b/cli/tests/testdata/fmt/glob/data/test1.ts new file mode 100644 index 000000000..e939e4595 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/data/test1.ts @@ -0,0 +1,2 @@ + function foo() { +} diff --git a/cli/tests/testdata/fmt/glob/data/test12.ts b/cli/tests/testdata/fmt/glob/data/test12.ts new file mode 100644 index 000000000..0127c4af3 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/data/test12.ts @@ -0,0 +1,3 @@ + function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/fmt/glob/nested/fizz/bar.ts b/cli/tests/testdata/fmt/glob/nested/fizz/bar.ts new file mode 100644 index 000000000..e939e4595 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/nested/fizz/bar.ts @@ -0,0 +1,2 @@ + function foo() { +} diff --git a/cli/tests/testdata/fmt/glob/nested/fizz/bazz.ts b/cli/tests/testdata/fmt/glob/nested/fizz/bazz.ts new file mode 100644 index 000000000..0127c4af3 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/nested/fizz/bazz.ts @@ -0,0 +1,3 @@ + function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/fmt/glob/nested/fizz/fizz.ts b/cli/tests/testdata/fmt/glob/nested/fizz/fizz.ts new file mode 100644 index 000000000..e939e4595 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/nested/fizz/fizz.ts @@ -0,0 +1,2 @@ + function foo() { +} diff --git a/cli/tests/testdata/fmt/glob/nested/fizz/foo.ts b/cli/tests/testdata/fmt/glob/nested/fizz/foo.ts new file mode 100644 index 000000000..e939e4595 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/nested/fizz/foo.ts @@ -0,0 +1,2 @@ + function foo() { +} diff --git a/cli/tests/testdata/fmt/glob/nested/foo/bar.ts b/cli/tests/testdata/fmt/glob/nested/foo/bar.ts new file mode 100644 index 000000000..e939e4595 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/nested/foo/bar.ts @@ -0,0 +1,2 @@ + function foo() { +} diff --git a/cli/tests/testdata/fmt/glob/nested/foo/bazz.ts b/cli/tests/testdata/fmt/glob/nested/foo/bazz.ts new file mode 100644 index 000000000..0127c4af3 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/nested/foo/bazz.ts @@ -0,0 +1,3 @@ + function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/fmt/glob/nested/foo/fizz.ts b/cli/tests/testdata/fmt/glob/nested/foo/fizz.ts new file mode 100644 index 000000000..e939e4595 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/nested/foo/fizz.ts @@ -0,0 +1,2 @@ + function foo() { +} diff --git a/cli/tests/testdata/fmt/glob/nested/foo/foo.ts b/cli/tests/testdata/fmt/glob/nested/foo/foo.ts new file mode 100644 index 000000000..e939e4595 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/nested/foo/foo.ts @@ -0,0 +1,2 @@ + function foo() { +} diff --git a/cli/tests/testdata/fmt/glob/pages/[id].ts b/cli/tests/testdata/fmt/glob/pages/[id].ts new file mode 100644 index 000000000..e939e4595 --- /dev/null +++ b/cli/tests/testdata/fmt/glob/pages/[id].ts @@ -0,0 +1,2 @@ + function foo() { +} diff --git a/cli/tests/testdata/lint/deno.glob.json b/cli/tests/testdata/lint/deno.glob.json new file mode 100644 index 000000000..f6781b0d8 --- /dev/null +++ b/cli/tests/testdata/lint/deno.glob.json @@ -0,0 +1,11 @@ +{ + "lint": { + "include": [ + "glob/data/test1.?s", + "glob/nested/foo/*.ts", + "glob/nested/fizz/*.ts", + "glob/pages/[id].ts" + ], + "exclude": ["glob/nested/**/*bazz.ts"] + } +} diff --git a/cli/tests/testdata/lint/glob/data/tes.ts b/cli/tests/testdata/lint/glob/data/tes.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/data/tes.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/lint/glob/data/test1.js b/cli/tests/testdata/lint/glob/data/test1.js new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/data/test1.js @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/lint/glob/data/test1.ts b/cli/tests/testdata/lint/glob/data/test1.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/data/test1.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/lint/glob/data/test12.ts b/cli/tests/testdata/lint/glob/data/test12.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/data/test12.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/lint/glob/nested/fizz/bar.ts b/cli/tests/testdata/lint/glob/nested/fizz/bar.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/nested/fizz/bar.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/lint/glob/nested/fizz/bazz.ts b/cli/tests/testdata/lint/glob/nested/fizz/bazz.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/nested/fizz/bazz.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/lint/glob/nested/fizz/fizz.ts b/cli/tests/testdata/lint/glob/nested/fizz/fizz.ts new file mode 100644 index 000000000..6940729e9 --- /dev/null +++ b/cli/tests/testdata/lint/glob/nested/fizz/fizz.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/cli/tests/testdata/lint/glob/nested/fizz/foo.ts b/cli/tests/testdata/lint/glob/nested/fizz/foo.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/nested/fizz/foo.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/lint/glob/nested/foo/bar.ts b/cli/tests/testdata/lint/glob/nested/foo/bar.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/nested/foo/bar.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/lint/glob/nested/foo/bazz.ts b/cli/tests/testdata/lint/glob/nested/foo/bazz.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/nested/foo/bazz.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/lint/glob/nested/foo/fizz.ts b/cli/tests/testdata/lint/glob/nested/foo/fizz.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/nested/foo/fizz.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/lint/glob/nested/foo/foo.ts b/cli/tests/testdata/lint/glob/nested/foo/foo.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/nested/foo/foo.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/lint/glob/pages/[id].ts b/cli/tests/testdata/lint/glob/pages/[id].ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/lint/glob/pages/[id].ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/deno.glob.json b/cli/tests/testdata/test/deno.glob.json new file mode 100644 index 000000000..9deb4d2f2 --- /dev/null +++ b/cli/tests/testdata/test/deno.glob.json @@ -0,0 +1,11 @@ +{ + "test": { + "include": [ + "glob/data/test1.?s", + "glob/nested/foo/*.ts", + "glob/nested/fizz/*.ts", + "glob/pages/[id].ts" + ], + "exclude": ["glob/nested/**/*bazz.ts"] + } +} diff --git a/cli/tests/testdata/test/glob/data/tes.ts b/cli/tests/testdata/test/glob/data/tes.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/data/tes.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/glob/data/test1.js b/cli/tests/testdata/test/glob/data/test1.js new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/data/test1.js @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/glob/data/test1.ts b/cli/tests/testdata/test/glob/data/test1.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/data/test1.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/glob/data/test12.ts b/cli/tests/testdata/test/glob/data/test12.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/data/test12.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/glob/nested/fizz/bar.ts b/cli/tests/testdata/test/glob/nested/fizz/bar.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/nested/fizz/bar.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/glob/nested/fizz/bazz.ts b/cli/tests/testdata/test/glob/nested/fizz/bazz.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/nested/fizz/bazz.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/glob/nested/fizz/fizz.ts b/cli/tests/testdata/test/glob/nested/fizz/fizz.ts new file mode 100644 index 000000000..6940729e9 --- /dev/null +++ b/cli/tests/testdata/test/glob/nested/fizz/fizz.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/cli/tests/testdata/test/glob/nested/fizz/foo.ts b/cli/tests/testdata/test/glob/nested/fizz/foo.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/nested/fizz/foo.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/glob/nested/foo/bar.ts b/cli/tests/testdata/test/glob/nested/foo/bar.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/nested/foo/bar.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/glob/nested/foo/bazz.ts b/cli/tests/testdata/test/glob/nested/foo/bazz.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/nested/foo/bazz.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/glob/nested/foo/fizz.ts b/cli/tests/testdata/test/glob/nested/foo/fizz.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/nested/foo/fizz.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/glob/nested/foo/foo.ts b/cli/tests/testdata/test/glob/nested/foo/foo.ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/nested/foo/foo.ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file diff --git a/cli/tests/testdata/test/glob/pages/[id].ts b/cli/tests/testdata/test/glob/pages/[id].ts new file mode 100644 index 000000000..26f07fba5 --- /dev/null +++ b/cli/tests/testdata/test/glob/pages/[id].ts @@ -0,0 +1,3 @@ +function foo() { + +}
\ No newline at end of file |