From 36a1a79f175b2df31d8ba5d7e121239c3b7e74ea Mon Sep 17 00:00:00 2001 From: HasanAlrimawi <141642411+HasanAlrimawi@users.noreply.github.com> Date: Mon, 16 Sep 2024 20:45:25 +0300 Subject: [PATCH] chore: deprecate lint itests (#25655) --- tests/integration/lint_tests.rs | 267 ------------------ tests/integration/mod.rs | 2 - tests/specs/lint/all/__test__.jsonc | 5 + .../lint => specs/lint/all}/expected.out | 0 .../lint/all}/file1.js | 0 .../lint/all}/file2.ts | 0 .../lint/all}/ignored_file.ts | 0 tests/specs/lint/compact/__test__.jsonc | 5 + .../lint/compact}/expected_compact.out | 0 tests/specs/lint/compact/file1.js | 2 + tests/specs/lint/glob/__test__.jsonc | 5 + .../lint/glob}/expected_glob.out | 0 .../lint => specs/lint/glob}/with_config/a.ts | 0 .../lint => specs/lint/glob}/with_config/b.ts | 0 tests/specs/lint/glob/without_config/file1.js | 2 + tests/specs/lint/glob/without_config/file2.ts | 6 + .../lint/glob/without_config/ignored_file.ts | 3 + .../lint/glob}/without_config/malformed.js | 0 tests/specs/lint/ignore/__test__.jsonc | 5 + .../lint/ignore}/expected_ignore.out | 0 .../specs/lint/ignore/without_config/file1.js | 2 + .../specs/lint/ignore/without_config/file2.ts | 6 + .../ignore/without_config/ignored_file.ts | 3 + .../lint/ignore/without_config/malformed.js | 4 + .../ignore_unexplicit_files/__test__.jsonc | 5 + .../lint/ignore_unexplicit_files/lint.out | 1 + tests/specs/lint/json/__test__.jsonc | 5 + .../lint/json}/expected_json.out | 0 tests/specs/lint/json/file1.js | 2 + tests/specs/lint/json/file2.ts | 6 + tests/specs/lint/json/ignored_file.ts | 3 + tests/specs/lint/json/malformed.js | 4 + tests/specs/lint/jsx/__test__.jsonc | 16 ++ tests/specs/lint/jsx/main.jsx | 1 + tests/specs/lint/jsx/main_unix.out | 12 + tests/specs/lint/jsx/main_windows.out | 12 + .../__test__.jsonc | 16 ++ .../actually_excluded.ts | 1 + .../deno.json | 6 + .../excluded.ts | 1 + .../main.ts | 1 + .../main_unix.out | 24 ++ .../main_windows.out | 24 ++ tests/specs/lint/quiet/__test__.jsonc | 5 + .../lint/quiet}/expected_quiet.out | 0 tests/specs/lint/quiet/file1.js | 2 + tests/specs/lint/rules/__test__.jsonc | 5 + .../lint/rules}/expected_rules.out | 0 tests/specs/lint/rules_quiet/__test__.jsonc | 5 + .../specs/lint/rules_quiet/expected_rules.out | 2 + tests/specs/lint/stdin/__test__.jsonc | 5 + .../lint/stdin}/expected_from_stdin.out | 2 +- tests/specs/lint/stdin/main.ts | 1 + tests/specs/lint/stdin_json/__test__.jsonc | 5 + .../stdin_json}/expected_from_stdin_json.out | 2 +- tests/specs/lint/stdin_json/main.ts | 1 + .../lint/with_config}/Deno.jsonc | 0 tests/specs/lint/with_config/__test__.jsonc | 5 + .../lint/with_config}/with_config.out | 0 tests/specs/lint/with_config/with_config/a.ts | 4 + tests/specs/lint/with_config/with_config/b.ts | 4 + .../lint/with_config_and_flags/Deno.jsonc | 10 + .../lint/with_config_and_flags/__test__.jsonc | 5 + .../with_config_and_flags/with_config/a.ts | 4 + .../with_config_and_flags/with_config/b.ts | 4 + .../with_config_and_flags.out | 0 .../Deno.no_tags.jsonc | 0 .../with_config_without_args/__test__.jsonc | 5 + .../with_config_without_args/with_config/a.ts | 4 + .../with_config_without_args/with_config/b.ts | 4 + .../with_config_without_tags.out | 0 .../lint/with_glob_config/__test__.jsonc | 16 ++ .../lint/with_glob_config}/deno.glob.json | 0 .../lint/with_glob_config/glob/data/tes.ts} | 0 .../lint/with_glob_config}/glob/data/test1.js | 3 +- .../lint/with_glob_config}/glob/data/test1.ts | 3 +- .../with_glob_config}/glob/data/test12.ts | 3 +- .../with_glob_config}/glob/nested/fizz/bar.ts | 3 +- .../glob/nested/fizz/bazz.ts | 3 +- .../glob/nested/fizz}/fizz.ts | 3 +- .../with_glob_config}/glob/nested/fizz/foo.ts | 3 +- .../with_glob_config}/glob/nested/foo/bar.ts | 3 +- .../with_glob_config}/glob/nested/foo/bazz.ts | 3 +- .../with_glob_config/glob/nested/foo/fizz.ts | 2 + .../with_glob_config}/glob/nested/foo/foo.ts | 3 +- .../lint/with_glob_config}/glob/pages/[id].ts | 3 +- .../with_glob_config_unix.out | 94 ++++++ .../with_glob_config_windows.out | 94 ++++++ .../with_glob_config_and_flags/__test__.jsonc | 16 ++ .../with_glob_config_and_flags/deno.glob.json | 11 + .../glob/data/tes.ts | 3 +- .../glob/data/test1.js | 2 + .../glob/data/test1.ts | 2 + .../glob/data/test12.ts | 2 + .../glob/nested/fizz/bar.ts | 2 + .../glob/nested/fizz/bazz.ts | 2 + .../glob/nested/fizz/fizz.ts | 2 + .../glob/nested/fizz/foo.ts | 2 + .../glob/nested/foo/bar.ts | 2 + .../glob/nested/foo/bazz.ts | 2 + .../glob/nested/foo/fizz.ts | 2 + .../glob/nested/foo/foo.ts | 2 + .../glob/pages/[id].ts | 2 + .../with_glob_config_and_flags_unix.out | 114 ++++++++ .../with_glob_config_and_flags_windows.out | 114 ++++++++ .../Deno.malformed.jsonc | 0 .../lint/with_malformed_config/__test__.jsonc | 5 + .../with_malformed_config.out | 0 .../Deno.malformed2.jsonc | 0 .../with_malformed_config2/__test__.jsonc | 5 + .../with_malformed_config2.out | 0 .../Deno.compact.format.jsonc | 0 .../lint/with_report_config/__test__.jsonc | 5 + .../lint/with_report_config/with_config/a.ts | 4 + .../lint/with_report_config/with_config/b.ts | 4 + .../with_report_config_compact.out | 0 .../Deno.compact.format.jsonc | 11 + .../__test__.jsonc | 5 + .../with_config/a.ts | 4 + .../with_config/b.ts | 4 + .../with_report_config_override.out | 0 tests/testdata/lint/expected_verbose.out | 3 - tools/lint.js | 1 - 123 files changed, 814 insertions(+), 299 deletions(-) delete mode 100644 tests/integration/lint_tests.rs create mode 100644 tests/specs/lint/all/__test__.jsonc rename tests/{testdata/lint => specs/lint/all}/expected.out (100%) rename tests/{testdata/lint/without_config => specs/lint/all}/file1.js (100%) rename tests/{testdata/lint/without_config => specs/lint/all}/file2.ts (100%) rename tests/{testdata/lint/without_config => specs/lint/all}/ignored_file.ts (100%) create mode 100644 tests/specs/lint/compact/__test__.jsonc rename tests/{testdata/lint => specs/lint/compact}/expected_compact.out (100%) create mode 100644 tests/specs/lint/compact/file1.js create mode 100644 tests/specs/lint/glob/__test__.jsonc rename tests/{testdata/lint => specs/lint/glob}/expected_glob.out (100%) rename tests/{testdata/lint => specs/lint/glob}/with_config/a.ts (100%) rename tests/{testdata/lint => specs/lint/glob}/with_config/b.ts (100%) create mode 100644 tests/specs/lint/glob/without_config/file1.js create mode 100644 tests/specs/lint/glob/without_config/file2.ts create mode 100644 tests/specs/lint/glob/without_config/ignored_file.ts rename tests/{testdata/lint => specs/lint/glob}/without_config/malformed.js (100%) create mode 100644 tests/specs/lint/ignore/__test__.jsonc rename tests/{testdata/lint => specs/lint/ignore}/expected_ignore.out (100%) create mode 100644 tests/specs/lint/ignore/without_config/file1.js create mode 100644 tests/specs/lint/ignore/without_config/file2.ts create mode 100644 tests/specs/lint/ignore/without_config/ignored_file.ts create mode 100644 tests/specs/lint/ignore/without_config/malformed.js create mode 100644 tests/specs/lint/ignore_unexplicit_files/__test__.jsonc create mode 100644 tests/specs/lint/ignore_unexplicit_files/lint.out create mode 100644 tests/specs/lint/json/__test__.jsonc rename tests/{testdata/lint => specs/lint/json}/expected_json.out (100%) create mode 100644 tests/specs/lint/json/file1.js create mode 100644 tests/specs/lint/json/file2.ts create mode 100644 tests/specs/lint/json/ignored_file.ts create mode 100644 tests/specs/lint/json/malformed.js create mode 100644 tests/specs/lint/jsx/__test__.jsonc create mode 100644 tests/specs/lint/jsx/main.jsx create mode 100644 tests/specs/lint/jsx/main_unix.out create mode 100644 tests/specs/lint/jsx/main_windows.out create mode 100644 tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/__test__.jsonc create mode 100644 tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/actually_excluded.ts create mode 100644 tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/deno.json create mode 100644 tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/excluded.ts create mode 100644 tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main.ts create mode 100644 tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main_unix.out create mode 100644 tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main_windows.out create mode 100644 tests/specs/lint/quiet/__test__.jsonc rename tests/{testdata/lint => specs/lint/quiet}/expected_quiet.out (100%) create mode 100644 tests/specs/lint/quiet/file1.js create mode 100644 tests/specs/lint/rules/__test__.jsonc rename tests/{testdata/lint => specs/lint/rules}/expected_rules.out (100%) create mode 100644 tests/specs/lint/rules_quiet/__test__.jsonc create mode 100644 tests/specs/lint/rules_quiet/expected_rules.out create mode 100644 tests/specs/lint/stdin/__test__.jsonc rename tests/{testdata/lint => specs/lint/stdin}/expected_from_stdin.out (86%) create mode 100644 tests/specs/lint/stdin/main.ts create mode 100644 tests/specs/lint/stdin_json/__test__.jsonc rename tests/{testdata/lint => specs/lint/stdin_json}/expected_from_stdin_json.out (89%) create mode 100644 tests/specs/lint/stdin_json/main.ts rename tests/{testdata/lint => specs/lint/with_config}/Deno.jsonc (100%) create mode 100644 tests/specs/lint/with_config/__test__.jsonc rename tests/{testdata/lint => specs/lint/with_config}/with_config.out (100%) create mode 100644 tests/specs/lint/with_config/with_config/a.ts create mode 100644 tests/specs/lint/with_config/with_config/b.ts create mode 100644 tests/specs/lint/with_config_and_flags/Deno.jsonc create mode 100644 tests/specs/lint/with_config_and_flags/__test__.jsonc create mode 100644 tests/specs/lint/with_config_and_flags/with_config/a.ts create mode 100644 tests/specs/lint/with_config_and_flags/with_config/b.ts rename tests/{testdata/lint => specs/lint/with_config_and_flags}/with_config_and_flags.out (100%) rename tests/{testdata/lint => specs/lint/with_config_without_args}/Deno.no_tags.jsonc (100%) create mode 100644 tests/specs/lint/with_config_without_args/__test__.jsonc create mode 100644 tests/specs/lint/with_config_without_args/with_config/a.ts create mode 100644 tests/specs/lint/with_config_without_args/with_config/b.ts rename tests/{testdata/lint => specs/lint/with_config_without_args}/with_config_without_tags.out (100%) create mode 100644 tests/specs/lint/with_glob_config/__test__.jsonc rename tests/{testdata/lint => specs/lint/with_glob_config}/deno.glob.json (100%) rename tests/{testdata/lint/glob/nested/fizz/fizz.ts => specs/lint/with_glob_config/glob/data/tes.ts} (100%) rename tests/{testdata/lint => specs/lint/with_glob_config}/glob/data/test1.js (73%) rename tests/{testdata/lint => specs/lint/with_glob_config}/glob/data/test1.ts (73%) rename tests/{testdata/lint => specs/lint/with_glob_config}/glob/data/test12.ts (73%) rename tests/{testdata/lint => specs/lint/with_glob_config}/glob/nested/fizz/bar.ts (73%) rename tests/{testdata/lint => specs/lint/with_glob_config}/glob/nested/fizz/bazz.ts (73%) rename tests/{testdata/lint/glob/nested/foo => specs/lint/with_glob_config/glob/nested/fizz}/fizz.ts (73%) rename tests/{testdata/lint => specs/lint/with_glob_config}/glob/nested/fizz/foo.ts (73%) rename tests/{testdata/lint => specs/lint/with_glob_config}/glob/nested/foo/bar.ts (73%) rename tests/{testdata/lint => specs/lint/with_glob_config}/glob/nested/foo/bazz.ts (73%) create mode 100644 tests/specs/lint/with_glob_config/glob/nested/foo/fizz.ts rename tests/{testdata/lint => specs/lint/with_glob_config}/glob/nested/foo/foo.ts (73%) rename tests/{testdata/lint => specs/lint/with_glob_config}/glob/pages/[id].ts (73%) create mode 100644 tests/specs/lint/with_glob_config/with_glob_config_unix.out create mode 100644 tests/specs/lint/with_glob_config/with_glob_config_windows.out create mode 100644 tests/specs/lint/with_glob_config_and_flags/__test__.jsonc create mode 100644 tests/specs/lint/with_glob_config_and_flags/deno.glob.json rename tests/{testdata/lint => specs/lint/with_glob_config_and_flags}/glob/data/tes.ts (73%) create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/data/test1.js create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/data/test1.ts create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/data/test12.ts create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/bar.ts create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/bazz.ts create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/fizz.ts create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/foo.ts create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/bar.ts create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/bazz.ts create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/fizz.ts create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/foo.ts create mode 100644 tests/specs/lint/with_glob_config_and_flags/glob/pages/[id].ts create mode 100644 tests/specs/lint/with_glob_config_and_flags/with_glob_config_and_flags_unix.out create mode 100644 tests/specs/lint/with_glob_config_and_flags/with_glob_config_and_flags_windows.out rename tests/{testdata/lint => specs/lint/with_malformed_config}/Deno.malformed.jsonc (100%) create mode 100644 tests/specs/lint/with_malformed_config/__test__.jsonc rename tests/{testdata/lint => specs/lint/with_malformed_config}/with_malformed_config.out (100%) rename tests/{testdata/lint => specs/lint/with_malformed_config2}/Deno.malformed2.jsonc (100%) create mode 100644 tests/specs/lint/with_malformed_config2/__test__.jsonc rename tests/{testdata/lint => specs/lint/with_malformed_config2}/with_malformed_config2.out (100%) rename tests/{testdata/lint => specs/lint/with_report_config}/Deno.compact.format.jsonc (100%) create mode 100644 tests/specs/lint/with_report_config/__test__.jsonc create mode 100644 tests/specs/lint/with_report_config/with_config/a.ts create mode 100644 tests/specs/lint/with_report_config/with_config/b.ts rename tests/{testdata/lint => specs/lint/with_report_config}/with_report_config_compact.out (100%) create mode 100644 tests/specs/lint/with_report_config_override/Deno.compact.format.jsonc create mode 100644 tests/specs/lint/with_report_config_override/__test__.jsonc create mode 100644 tests/specs/lint/with_report_config_override/with_config/a.ts create mode 100644 tests/specs/lint/with_report_config_override/with_config/b.ts rename tests/{testdata/lint => specs/lint/with_report_config_override}/with_report_config_override.out (100%) delete mode 100644 tests/testdata/lint/expected_verbose.out diff --git a/tests/integration/lint_tests.rs b/tests/integration/lint_tests.rs deleted file mode 100644 index b47a98da4d..0000000000 --- a/tests/integration/lint_tests.rs +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - -use deno_core::serde_json::json; -use test_util::assert_contains; -use test_util::assert_not_contains; -use test_util::itest; -use test_util::TestContext; -use test_util::TestContextBuilder; - -itest!(ignore_unexplicit_files { - args: "lint --ignore=./", - output_str: Some("error: No target files found.\n"), - exit_code: 1, -}); - -itest!(all { - args: "lint lint/without_config/file1.js lint/without_config/file2.ts lint/without_config/ignored_file.ts", - output: "lint/expected.out", - exit_code: 1, -}); - -itest!(quiet { - args: "lint --quiet lint/without_config/file1.js", - output: "lint/expected_quiet.out", - exit_code: 1, -}); - -itest!(json { - args: - "lint --json lint/without_config/file1.js lint/without_config/file2.ts lint/without_config/ignored_file.ts lint/without_config/malformed.js", - output: "lint/expected_json.out", - exit_code: 1, -}); - -itest!(compact { - args: - "lint --compact lint/without_config/file1.js lint/without_config/ignored_file.tss", - output: "lint/expected_compact.out", - exit_code: 1, -}); - -itest!(ignore { - args: - "lint --ignore=lint/without_config/file1.js,lint/without_config/malformed.js,lint/without_config/lint_with_config/ lint/without_config/", - output: "lint/expected_ignore.out", - exit_code: 1, -}); - -itest!(glob { - args: "lint --ignore=lint/without_config/malformed.js,lint/with_config/ lint/without_config/", - output: "lint/expected_glob.out", - exit_code: 1, -}); - -itest!(stdin { - args: "lint -", - input: Some("let _a: any;"), - output: "lint/expected_from_stdin.out", - exit_code: 1, -}); - -itest!(stdin_json { - args: "lint --json -", - input: Some("let _a: any;"), - output: "lint/expected_from_stdin_json.out", - exit_code: 1, -}); - -itest!(rules { - args: "lint --rules", - output: "lint/expected_rules.out", - exit_code: 0, -}); - -// Make sure that the rules are printed if quiet option is enabled. -itest!(rules_quiet { - args: "lint --rules -q", - output: "lint/expected_rules.out", - exit_code: 0, -}); - -itest!(lint_with_config { - args: "lint --config lint/Deno.jsonc lint/with_config/", - output: "lint/with_config.out", - exit_code: 1, -}); - -itest!(lint_with_report_config { - args: "lint --config lint/Deno.compact.format.jsonc lint/with_config/", - output: "lint/with_report_config_compact.out", - exit_code: 1, -}); - -// Check if CLI flags take precedence -itest!(lint_with_report_config_override { - args: "lint --config lint/Deno.compact.format.jsonc lint/with_config/ --json", - output: "lint/with_report_config_override.out", - exit_code: 1, -}); - -itest!(lint_with_config_and_flags { - args: "lint --config lint/Deno.jsonc --ignore=lint/with_config/a.ts", - output: "lint/with_config_and_flags.out", - exit_code: 1, -}); - -itest!(lint_with_config_without_tags { - args: "lint --config lint/Deno.no_tags.jsonc lint/with_config/", - output: "lint/with_config_without_tags.out", - exit_code: 1, -}); - -itest!(lint_with_malformed_config { - args: "lint --config lint/Deno.malformed.jsonc", - output: "lint/with_malformed_config.out", - exit_code: 1, -}); - -itest!(lint_with_malformed_config2 { - args: "lint --config lint/Deno.malformed2.jsonc", - 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"); -} - -#[test] -fn opt_out_top_level_exclude_via_lint_unexclude() { - let context = TestContextBuilder::new().use_temp_cwd().build(); - let temp_dir = context.temp_dir().path(); - temp_dir.join("deno.json").write_json(&json!({ - "lint": { - "exclude": [ "!excluded.ts" ] - }, - "exclude": [ "excluded.ts", "actually_excluded.ts" ] - })); - - temp_dir.join("main.ts").write("const a = 1;"); - temp_dir.join("excluded.ts").write("const a = 2;"); - temp_dir.join("actually_excluded.ts").write("const a = 2;"); - - let output = context.new_command().arg("lint").run(); - output.assert_exit_code(1); - let output = output.combined_output(); - assert_contains!(output, "main.ts"); - assert_contains!(output, "excluded.ts"); - assert_not_contains!(output, "actually_excluded.ts"); -} - -#[test] -fn lint_stdin_jsx() { - TestContext::default() - .new_command() - .args("lint --ext=jsx -") - .stdin_text( - r#" -const data =
hello
; -"#, - ) - .run() - .assert_matches_text( - r#"error[no-unused-vars]: `data` is never used - --> [WILDLINE]$deno$stdin.jsx:2:7 - | -2 | const data =
hello
; - | ^^^^ - = hint: If this is intentional, prefix it with an underscore like `_data` - - docs: https://lint.deno.land/rules/no-unused-vars - - -Found 1 problem -Checked 1 file -"#, - ) - .assert_exit_code(1); -} diff --git a/tests/integration/mod.rs b/tests/integration/mod.rs index 5cbe2a2ff3..37c7502284 100644 --- a/tests/integration/mod.rs +++ b/tests/integration/mod.rs @@ -35,8 +35,6 @@ mod js_unit_tests; mod jsr; #[path = "jupyter_tests.rs"] mod jupyter; -#[path = "lint_tests.rs"] -mod lint; #[path = "lsp_tests.rs"] mod lsp; #[path = "node_unit_tests.rs"] diff --git a/tests/specs/lint/all/__test__.jsonc b/tests/specs/lint/all/__test__.jsonc new file mode 100644 index 0000000000..0583ceca96 --- /dev/null +++ b/tests/specs/lint/all/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint file1.js file2.ts ignored_file.ts", + "output": "expected.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/expected.out b/tests/specs/lint/all/expected.out similarity index 100% rename from tests/testdata/lint/expected.out rename to tests/specs/lint/all/expected.out diff --git a/tests/testdata/lint/without_config/file1.js b/tests/specs/lint/all/file1.js similarity index 100% rename from tests/testdata/lint/without_config/file1.js rename to tests/specs/lint/all/file1.js diff --git a/tests/testdata/lint/without_config/file2.ts b/tests/specs/lint/all/file2.ts similarity index 100% rename from tests/testdata/lint/without_config/file2.ts rename to tests/specs/lint/all/file2.ts diff --git a/tests/testdata/lint/without_config/ignored_file.ts b/tests/specs/lint/all/ignored_file.ts similarity index 100% rename from tests/testdata/lint/without_config/ignored_file.ts rename to tests/specs/lint/all/ignored_file.ts diff --git a/tests/specs/lint/compact/__test__.jsonc b/tests/specs/lint/compact/__test__.jsonc new file mode 100644 index 0000000000..d5e1eef546 --- /dev/null +++ b/tests/specs/lint/compact/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --compact file1.js ignored_file.tss", + "output": "expected_compact.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/expected_compact.out b/tests/specs/lint/compact/expected_compact.out similarity index 100% rename from tests/testdata/lint/expected_compact.out rename to tests/specs/lint/compact/expected_compact.out diff --git a/tests/specs/lint/compact/file1.js b/tests/specs/lint/compact/file1.js new file mode 100644 index 0000000000..737f26818b --- /dev/null +++ b/tests/specs/lint/compact/file1.js @@ -0,0 +1,2 @@ +// deno-lint-ignore +while (false) {} diff --git a/tests/specs/lint/glob/__test__.jsonc b/tests/specs/lint/glob/__test__.jsonc new file mode 100644 index 0000000000..454a55804b --- /dev/null +++ b/tests/specs/lint/glob/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --ignore=without_config/malformed.js,with_config/ without_config/", + "output": "expected_glob.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/expected_glob.out b/tests/specs/lint/glob/expected_glob.out similarity index 100% rename from tests/testdata/lint/expected_glob.out rename to tests/specs/lint/glob/expected_glob.out diff --git a/tests/testdata/lint/with_config/a.ts b/tests/specs/lint/glob/with_config/a.ts similarity index 100% rename from tests/testdata/lint/with_config/a.ts rename to tests/specs/lint/glob/with_config/a.ts diff --git a/tests/testdata/lint/with_config/b.ts b/tests/specs/lint/glob/with_config/b.ts similarity index 100% rename from tests/testdata/lint/with_config/b.ts rename to tests/specs/lint/glob/with_config/b.ts diff --git a/tests/specs/lint/glob/without_config/file1.js b/tests/specs/lint/glob/without_config/file1.js new file mode 100644 index 0000000000..737f26818b --- /dev/null +++ b/tests/specs/lint/glob/without_config/file1.js @@ -0,0 +1,2 @@ +// deno-lint-ignore +while (false) {} diff --git a/tests/specs/lint/glob/without_config/file2.ts b/tests/specs/lint/glob/without_config/file2.ts new file mode 100644 index 0000000000..73c612c35f --- /dev/null +++ b/tests/specs/lint/glob/without_config/file2.ts @@ -0,0 +1,6 @@ +try { + await Deno.open("./some/file.txt"); +} catch (_e) {} + +// deno-lint-ignore no-explicit-any +function _foo(): any {} diff --git a/tests/specs/lint/glob/without_config/ignored_file.ts b/tests/specs/lint/glob/without_config/ignored_file.ts new file mode 100644 index 0000000000..97befafa38 --- /dev/null +++ b/tests/specs/lint/glob/without_config/ignored_file.ts @@ -0,0 +1,3 @@ +// deno-lint-ignore-file + +function foo(): any {} diff --git a/tests/testdata/lint/without_config/malformed.js b/tests/specs/lint/glob/without_config/malformed.js similarity index 100% rename from tests/testdata/lint/without_config/malformed.js rename to tests/specs/lint/glob/without_config/malformed.js diff --git a/tests/specs/lint/ignore/__test__.jsonc b/tests/specs/lint/ignore/__test__.jsonc new file mode 100644 index 0000000000..5bbe237ce8 --- /dev/null +++ b/tests/specs/lint/ignore/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --ignore=without_config/file1.js,without_config/malformed.js,without_config/lint_with_config/ without_config", + "output": "expected_ignore.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/expected_ignore.out b/tests/specs/lint/ignore/expected_ignore.out similarity index 100% rename from tests/testdata/lint/expected_ignore.out rename to tests/specs/lint/ignore/expected_ignore.out diff --git a/tests/specs/lint/ignore/without_config/file1.js b/tests/specs/lint/ignore/without_config/file1.js new file mode 100644 index 0000000000..737f26818b --- /dev/null +++ b/tests/specs/lint/ignore/without_config/file1.js @@ -0,0 +1,2 @@ +// deno-lint-ignore +while (false) {} diff --git a/tests/specs/lint/ignore/without_config/file2.ts b/tests/specs/lint/ignore/without_config/file2.ts new file mode 100644 index 0000000000..73c612c35f --- /dev/null +++ b/tests/specs/lint/ignore/without_config/file2.ts @@ -0,0 +1,6 @@ +try { + await Deno.open("./some/file.txt"); +} catch (_e) {} + +// deno-lint-ignore no-explicit-any +function _foo(): any {} diff --git a/tests/specs/lint/ignore/without_config/ignored_file.ts b/tests/specs/lint/ignore/without_config/ignored_file.ts new file mode 100644 index 0000000000..97befafa38 --- /dev/null +++ b/tests/specs/lint/ignore/without_config/ignored_file.ts @@ -0,0 +1,3 @@ +// deno-lint-ignore-file + +function foo(): any {} diff --git a/tests/specs/lint/ignore/without_config/malformed.js b/tests/specs/lint/ignore/without_config/malformed.js new file mode 100644 index 0000000000..9b64da898c --- /dev/null +++ b/tests/specs/lint/ignore/without_config/malformed.js @@ -0,0 +1,4 @@ +// deno-fmt-ignore-file + +// intentionally malformed file +export class A B C \ No newline at end of file diff --git a/tests/specs/lint/ignore_unexplicit_files/__test__.jsonc b/tests/specs/lint/ignore_unexplicit_files/__test__.jsonc new file mode 100644 index 0000000000..7653c4e255 --- /dev/null +++ b/tests/specs/lint/ignore_unexplicit_files/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --ignore=./", + "output": "lint.out", + "exitCode": 1 +} diff --git a/tests/specs/lint/ignore_unexplicit_files/lint.out b/tests/specs/lint/ignore_unexplicit_files/lint.out new file mode 100644 index 0000000000..33f4ddd933 --- /dev/null +++ b/tests/specs/lint/ignore_unexplicit_files/lint.out @@ -0,0 +1 @@ +error: No target files found. diff --git a/tests/specs/lint/json/__test__.jsonc b/tests/specs/lint/json/__test__.jsonc new file mode 100644 index 0000000000..fb577c0dd7 --- /dev/null +++ b/tests/specs/lint/json/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --json file1.js file2.ts ignored_file.ts malformed.js", + "output": "expected_json.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/expected_json.out b/tests/specs/lint/json/expected_json.out similarity index 100% rename from tests/testdata/lint/expected_json.out rename to tests/specs/lint/json/expected_json.out diff --git a/tests/specs/lint/json/file1.js b/tests/specs/lint/json/file1.js new file mode 100644 index 0000000000..737f26818b --- /dev/null +++ b/tests/specs/lint/json/file1.js @@ -0,0 +1,2 @@ +// deno-lint-ignore +while (false) {} diff --git a/tests/specs/lint/json/file2.ts b/tests/specs/lint/json/file2.ts new file mode 100644 index 0000000000..73c612c35f --- /dev/null +++ b/tests/specs/lint/json/file2.ts @@ -0,0 +1,6 @@ +try { + await Deno.open("./some/file.txt"); +} catch (_e) {} + +// deno-lint-ignore no-explicit-any +function _foo(): any {} diff --git a/tests/specs/lint/json/ignored_file.ts b/tests/specs/lint/json/ignored_file.ts new file mode 100644 index 0000000000..97befafa38 --- /dev/null +++ b/tests/specs/lint/json/ignored_file.ts @@ -0,0 +1,3 @@ +// deno-lint-ignore-file + +function foo(): any {} diff --git a/tests/specs/lint/json/malformed.js b/tests/specs/lint/json/malformed.js new file mode 100644 index 0000000000..9b64da898c --- /dev/null +++ b/tests/specs/lint/json/malformed.js @@ -0,0 +1,4 @@ +// deno-fmt-ignore-file + +// intentionally malformed file +export class A B C \ No newline at end of file diff --git a/tests/specs/lint/jsx/__test__.jsonc b/tests/specs/lint/jsx/__test__.jsonc new file mode 100644 index 0000000000..42dda30a56 --- /dev/null +++ b/tests/specs/lint/jsx/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "steps": [ + { + "if": "windows", + "args": "lint main.jsx", + "output": "main_windows.out", + "exitCode": 1 + }, + { + "if": "unix", + "args": "lint main.jsx", + "output": "main_unix.out", + "exitCode": 1 + } + ] +} diff --git a/tests/specs/lint/jsx/main.jsx b/tests/specs/lint/jsx/main.jsx new file mode 100644 index 0000000000..625e7d4307 --- /dev/null +++ b/tests/specs/lint/jsx/main.jsx @@ -0,0 +1 @@ +const data =
hello
; diff --git a/tests/specs/lint/jsx/main_unix.out b/tests/specs/lint/jsx/main_unix.out new file mode 100644 index 0000000000..08816e9fee --- /dev/null +++ b/tests/specs/lint/jsx/main_unix.out @@ -0,0 +1,12 @@ +error[no-unused-vars]: `data` is never used + --> [WILDCARD]lint/jsx/main.jsx:1:7 + | +1 | const data =
hello
; + | ^^^^ + = hint: If this is intentional, prefix it with an underscore like `_data` + + docs: https://lint.deno.land/rules/no-unused-vars + + +Found 1 problem +Checked 1 file diff --git a/tests/specs/lint/jsx/main_windows.out b/tests/specs/lint/jsx/main_windows.out new file mode 100644 index 0000000000..ec6ebecad9 --- /dev/null +++ b/tests/specs/lint/jsx/main_windows.out @@ -0,0 +1,12 @@ +error[no-unused-vars]: `data` is never used + --> [WILDCARD]lint\jsx\main.jsx:1:7 + | +1 | const data =
hello
; + | ^^^^ + = hint: If this is intentional, prefix it with an underscore like `_data` + + docs: https://lint.deno.land/rules/no-unused-vars + + +Found 1 problem +Checked 1 file diff --git a/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/__test__.jsonc b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/__test__.jsonc new file mode 100644 index 0000000000..ce4db1883a --- /dev/null +++ b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "steps": [ + { + "if": "windows", + "args": "lint", + "output": "main_windows.out", + "exitCode": 1 + }, + { + "if": "unix", + "args": "lint", + "output": "main_unix.out", + "exitCode": 1 + } + ] +} diff --git a/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/actually_excluded.ts b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/actually_excluded.ts new file mode 100644 index 0000000000..dd2bcc6112 --- /dev/null +++ b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/actually_excluded.ts @@ -0,0 +1 @@ +const a = 2; diff --git a/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/deno.json b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/deno.json new file mode 100644 index 0000000000..a7689f16d6 --- /dev/null +++ b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/deno.json @@ -0,0 +1,6 @@ +{ + "lint": { + "exclude": ["!excluded.ts"] + }, + "exclude": ["excluded.ts", "actually_excluded.ts"] +} diff --git a/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/excluded.ts b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/excluded.ts new file mode 100644 index 0000000000..dd2bcc6112 --- /dev/null +++ b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/excluded.ts @@ -0,0 +1 @@ +const a = 2; diff --git a/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main.ts b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main.ts new file mode 100644 index 0000000000..54b82a09ad --- /dev/null +++ b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main.ts @@ -0,0 +1 @@ +const a = 1; diff --git a/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main_unix.out b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main_unix.out new file mode 100644 index 0000000000..39a3e7746c --- /dev/null +++ b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main_unix.out @@ -0,0 +1,24 @@ +[UNORDERED_START] +error[no-unused-vars]: `a` is never used + --> [WILDLINE]lint/opt_out_top_level_exclude_via_lint_inexclude/main.ts:1:7 + | +1 | const a = 1; + | ^ + = hint: If this is intentional, prefix it with an underscore like `_a` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `a` is never used + --> [WILDLINE]lint/opt_out_top_level_exclude_via_lint_inexclude/excluded.ts:1:7 + | +1 | const a = 2; + | ^ + = hint: If this is intentional, prefix it with an underscore like `_a` + + docs: https://lint.deno.land/rules/no-unused-vars +[UNORDERED_END] + + +Found 2 problems +Checked 2 files diff --git a/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main_windows.out b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main_windows.out new file mode 100644 index 0000000000..8edf1133ea --- /dev/null +++ b/tests/specs/lint/opt_out_top_level_exclude_via_lint_inexclude/main_windows.out @@ -0,0 +1,24 @@ +[UNORDERED_START] +error[no-unused-vars]: `a` is never used + --> [WILDLINE]lint\opt_out_top_level_exclude_via_lint_inexclude\main.ts:1:7 + | +1 | const a = 1; + | ^ + = hint: If this is intentional, prefix it with an underscore like `_a` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `a` is never used + --> [WILDLINE]lint\opt_out_top_level_exclude_via_lint_inexclude\excluded.ts:1:7 + | +1 | const a = 2; + | ^ + = hint: If this is intentional, prefix it with an underscore like `_a` + + docs: https://lint.deno.land/rules/no-unused-vars +[UNORDERED_END] + + +Found 2 problems +Checked 2 files diff --git a/tests/specs/lint/quiet/__test__.jsonc b/tests/specs/lint/quiet/__test__.jsonc new file mode 100644 index 0000000000..44434f7a1c --- /dev/null +++ b/tests/specs/lint/quiet/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --quiet ", + "output": "expected_quiet.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/expected_quiet.out b/tests/specs/lint/quiet/expected_quiet.out similarity index 100% rename from tests/testdata/lint/expected_quiet.out rename to tests/specs/lint/quiet/expected_quiet.out diff --git a/tests/specs/lint/quiet/file1.js b/tests/specs/lint/quiet/file1.js new file mode 100644 index 0000000000..737f26818b --- /dev/null +++ b/tests/specs/lint/quiet/file1.js @@ -0,0 +1,2 @@ +// deno-lint-ignore +while (false) {} diff --git a/tests/specs/lint/rules/__test__.jsonc b/tests/specs/lint/rules/__test__.jsonc new file mode 100644 index 0000000000..d1b330b9ae --- /dev/null +++ b/tests/specs/lint/rules/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --rules", + "output": "expected_rules.out", + "exitCode": 0 +} diff --git a/tests/testdata/lint/expected_rules.out b/tests/specs/lint/rules/expected_rules.out similarity index 100% rename from tests/testdata/lint/expected_rules.out rename to tests/specs/lint/rules/expected_rules.out diff --git a/tests/specs/lint/rules_quiet/__test__.jsonc b/tests/specs/lint/rules_quiet/__test__.jsonc new file mode 100644 index 0000000000..0e7cc1a132 --- /dev/null +++ b/tests/specs/lint/rules_quiet/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --rules -q", + "output": "expected_rules.out", + "exitCode": 0 +} diff --git a/tests/specs/lint/rules_quiet/expected_rules.out b/tests/specs/lint/rules_quiet/expected_rules.out new file mode 100644 index 0000000000..4afab7b9bf --- /dev/null +++ b/tests/specs/lint/rules_quiet/expected_rules.out @@ -0,0 +1,2 @@ +Available rules: +[WILDCARD] diff --git a/tests/specs/lint/stdin/__test__.jsonc b/tests/specs/lint/stdin/__test__.jsonc new file mode 100644 index 0000000000..f6c688c16e --- /dev/null +++ b/tests/specs/lint/stdin/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint main.ts", + "output": "expected_from_stdin.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/expected_from_stdin.out b/tests/specs/lint/stdin/expected_from_stdin.out similarity index 86% rename from tests/testdata/lint/expected_from_stdin.out rename to tests/specs/lint/stdin/expected_from_stdin.out index 735b271f52..f65331ebd9 100644 --- a/tests/testdata/lint/expected_from_stdin.out +++ b/tests/specs/lint/stdin/expected_from_stdin.out @@ -1,5 +1,5 @@ error[no-explicit-any]: `any` type is not allowed - --> [WILDCARD]$deno$stdin.ts:1:9 + --> [WILDCARD]main.ts:1:9 | 1 | let _a: any; | ^^^ diff --git a/tests/specs/lint/stdin/main.ts b/tests/specs/lint/stdin/main.ts new file mode 100644 index 0000000000..8abcd79b87 --- /dev/null +++ b/tests/specs/lint/stdin/main.ts @@ -0,0 +1 @@ +let _a: any; diff --git a/tests/specs/lint/stdin_json/__test__.jsonc b/tests/specs/lint/stdin_json/__test__.jsonc new file mode 100644 index 0000000000..a777147f6c --- /dev/null +++ b/tests/specs/lint/stdin_json/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --json main.ts", + "output": "expected_from_stdin_json.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/expected_from_stdin_json.out b/tests/specs/lint/stdin_json/expected_from_stdin_json.out similarity index 89% rename from tests/testdata/lint/expected_from_stdin_json.out rename to tests/specs/lint/stdin_json/expected_from_stdin_json.out index 27b215b43d..5788248aa2 100644 --- a/tests/testdata/lint/expected_from_stdin_json.out +++ b/tests/specs/lint/stdin_json/expected_from_stdin_json.out @@ -2,7 +2,7 @@ "version": 1, "diagnostics": [ { - "filename": "[WILDCARD]$deno$stdin.ts", + "filename": "[WILDCARD]main.ts", "range": { "start": { "line": 1, diff --git a/tests/specs/lint/stdin_json/main.ts b/tests/specs/lint/stdin_json/main.ts new file mode 100644 index 0000000000..8abcd79b87 --- /dev/null +++ b/tests/specs/lint/stdin_json/main.ts @@ -0,0 +1 @@ +let _a: any; diff --git a/tests/testdata/lint/Deno.jsonc b/tests/specs/lint/with_config/Deno.jsonc similarity index 100% rename from tests/testdata/lint/Deno.jsonc rename to tests/specs/lint/with_config/Deno.jsonc diff --git a/tests/specs/lint/with_config/__test__.jsonc b/tests/specs/lint/with_config/__test__.jsonc new file mode 100644 index 0000000000..1e9bf97512 --- /dev/null +++ b/tests/specs/lint/with_config/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --config Deno.jsonc with_config/", + "output": "with_config.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/with_config.out b/tests/specs/lint/with_config/with_config.out similarity index 100% rename from tests/testdata/lint/with_config.out rename to tests/specs/lint/with_config/with_config.out diff --git a/tests/specs/lint/with_config/with_config/a.ts b/tests/specs/lint/with_config/with_config/a.ts new file mode 100644 index 0000000000..c378218a32 --- /dev/null +++ b/tests/specs/lint/with_config/with_config/a.ts @@ -0,0 +1,4 @@ +// TODO: foo +function add(a: number, b: number): number { + return a + b; +} diff --git a/tests/specs/lint/with_config/with_config/b.ts b/tests/specs/lint/with_config/with_config/b.ts new file mode 100644 index 0000000000..d5647067ea --- /dev/null +++ b/tests/specs/lint/with_config/with_config/b.ts @@ -0,0 +1,4 @@ +// TODO: this file should be ignored +function subtract(a: number, b: number): number { + return a - b; +} diff --git a/tests/specs/lint/with_config_and_flags/Deno.jsonc b/tests/specs/lint/with_config_and_flags/Deno.jsonc new file mode 100644 index 0000000000..e9c03cca4e --- /dev/null +++ b/tests/specs/lint/with_config_and_flags/Deno.jsonc @@ -0,0 +1,10 @@ +{ + "lint": { + "include": ["with_config/"], + "exclude": ["with_config/b.ts"], + "rules": { + "tags": ["recommended"], + "include": ["ban-untagged-todo"] + } + } +} diff --git a/tests/specs/lint/with_config_and_flags/__test__.jsonc b/tests/specs/lint/with_config_and_flags/__test__.jsonc new file mode 100644 index 0000000000..926d1983b2 --- /dev/null +++ b/tests/specs/lint/with_config_and_flags/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --config Deno.jsonc --ignore=with_config/a.ts", + "output": "with_config_and_flags.out", + "exitCode": 1 +} diff --git a/tests/specs/lint/with_config_and_flags/with_config/a.ts b/tests/specs/lint/with_config_and_flags/with_config/a.ts new file mode 100644 index 0000000000..c378218a32 --- /dev/null +++ b/tests/specs/lint/with_config_and_flags/with_config/a.ts @@ -0,0 +1,4 @@ +// TODO: foo +function add(a: number, b: number): number { + return a + b; +} diff --git a/tests/specs/lint/with_config_and_flags/with_config/b.ts b/tests/specs/lint/with_config_and_flags/with_config/b.ts new file mode 100644 index 0000000000..d5647067ea --- /dev/null +++ b/tests/specs/lint/with_config_and_flags/with_config/b.ts @@ -0,0 +1,4 @@ +// TODO: this file should be ignored +function subtract(a: number, b: number): number { + return a - b; +} diff --git a/tests/testdata/lint/with_config_and_flags.out b/tests/specs/lint/with_config_and_flags/with_config_and_flags.out similarity index 100% rename from tests/testdata/lint/with_config_and_flags.out rename to tests/specs/lint/with_config_and_flags/with_config_and_flags.out diff --git a/tests/testdata/lint/Deno.no_tags.jsonc b/tests/specs/lint/with_config_without_args/Deno.no_tags.jsonc similarity index 100% rename from tests/testdata/lint/Deno.no_tags.jsonc rename to tests/specs/lint/with_config_without_args/Deno.no_tags.jsonc diff --git a/tests/specs/lint/with_config_without_args/__test__.jsonc b/tests/specs/lint/with_config_without_args/__test__.jsonc new file mode 100644 index 0000000000..9a1ae7cb4d --- /dev/null +++ b/tests/specs/lint/with_config_without_args/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --config Deno.no_tags.jsonc with_config/", + "output": "with_config_without_tags.out", + "exitCode": 1 +} diff --git a/tests/specs/lint/with_config_without_args/with_config/a.ts b/tests/specs/lint/with_config_without_args/with_config/a.ts new file mode 100644 index 0000000000..c378218a32 --- /dev/null +++ b/tests/specs/lint/with_config_without_args/with_config/a.ts @@ -0,0 +1,4 @@ +// TODO: foo +function add(a: number, b: number): number { + return a + b; +} diff --git a/tests/specs/lint/with_config_without_args/with_config/b.ts b/tests/specs/lint/with_config_without_args/with_config/b.ts new file mode 100644 index 0000000000..d5647067ea --- /dev/null +++ b/tests/specs/lint/with_config_without_args/with_config/b.ts @@ -0,0 +1,4 @@ +// TODO: this file should be ignored +function subtract(a: number, b: number): number { + return a - b; +} diff --git a/tests/testdata/lint/with_config_without_tags.out b/tests/specs/lint/with_config_without_args/with_config_without_tags.out similarity index 100% rename from tests/testdata/lint/with_config_without_tags.out rename to tests/specs/lint/with_config_without_args/with_config_without_tags.out diff --git a/tests/specs/lint/with_glob_config/__test__.jsonc b/tests/specs/lint/with_glob_config/__test__.jsonc new file mode 100644 index 0000000000..578ed2f852 --- /dev/null +++ b/tests/specs/lint/with_glob_config/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "steps": [ + { + "if": "windows", + "args": "lint --config deno.glob.json", + "output": "with_glob_config_windows.out", + "exitCode": 1 + }, + { + "if": "unix", + "args": "lint --config deno.glob.json", + "output": "with_glob_config_unix.out", + "exitCode": 1 + } + ] +} diff --git a/tests/testdata/lint/deno.glob.json b/tests/specs/lint/with_glob_config/deno.glob.json similarity index 100% rename from tests/testdata/lint/deno.glob.json rename to tests/specs/lint/with_glob_config/deno.glob.json diff --git a/tests/testdata/lint/glob/nested/fizz/fizz.ts b/tests/specs/lint/with_glob_config/glob/data/tes.ts similarity index 100% rename from tests/testdata/lint/glob/nested/fizz/fizz.ts rename to tests/specs/lint/with_glob_config/glob/data/tes.ts diff --git a/tests/testdata/lint/glob/data/test1.js b/tests/specs/lint/with_glob_config/glob/data/test1.js similarity index 73% rename from tests/testdata/lint/glob/data/test1.js rename to tests/specs/lint/with_glob_config/glob/data/test1.js index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/data/test1.js +++ b/tests/specs/lint/with_glob_config/glob/data/test1.js @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/testdata/lint/glob/data/test1.ts b/tests/specs/lint/with_glob_config/glob/data/test1.ts similarity index 73% rename from tests/testdata/lint/glob/data/test1.ts rename to tests/specs/lint/with_glob_config/glob/data/test1.ts index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/data/test1.ts +++ b/tests/specs/lint/with_glob_config/glob/data/test1.ts @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/testdata/lint/glob/data/test12.ts b/tests/specs/lint/with_glob_config/glob/data/test12.ts similarity index 73% rename from tests/testdata/lint/glob/data/test12.ts rename to tests/specs/lint/with_glob_config/glob/data/test12.ts index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/data/test12.ts +++ b/tests/specs/lint/with_glob_config/glob/data/test12.ts @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/testdata/lint/glob/nested/fizz/bar.ts b/tests/specs/lint/with_glob_config/glob/nested/fizz/bar.ts similarity index 73% rename from tests/testdata/lint/glob/nested/fizz/bar.ts rename to tests/specs/lint/with_glob_config/glob/nested/fizz/bar.ts index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/nested/fizz/bar.ts +++ b/tests/specs/lint/with_glob_config/glob/nested/fizz/bar.ts @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/testdata/lint/glob/nested/fizz/bazz.ts b/tests/specs/lint/with_glob_config/glob/nested/fizz/bazz.ts similarity index 73% rename from tests/testdata/lint/glob/nested/fizz/bazz.ts rename to tests/specs/lint/with_glob_config/glob/nested/fizz/bazz.ts index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/nested/fizz/bazz.ts +++ b/tests/specs/lint/with_glob_config/glob/nested/fizz/bazz.ts @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/testdata/lint/glob/nested/foo/fizz.ts b/tests/specs/lint/with_glob_config/glob/nested/fizz/fizz.ts similarity index 73% rename from tests/testdata/lint/glob/nested/foo/fizz.ts rename to tests/specs/lint/with_glob_config/glob/nested/fizz/fizz.ts index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/nested/foo/fizz.ts +++ b/tests/specs/lint/with_glob_config/glob/nested/fizz/fizz.ts @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/testdata/lint/glob/nested/fizz/foo.ts b/tests/specs/lint/with_glob_config/glob/nested/fizz/foo.ts similarity index 73% rename from tests/testdata/lint/glob/nested/fizz/foo.ts rename to tests/specs/lint/with_glob_config/glob/nested/fizz/foo.ts index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/nested/fizz/foo.ts +++ b/tests/specs/lint/with_glob_config/glob/nested/fizz/foo.ts @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/testdata/lint/glob/nested/foo/bar.ts b/tests/specs/lint/with_glob_config/glob/nested/foo/bar.ts similarity index 73% rename from tests/testdata/lint/glob/nested/foo/bar.ts rename to tests/specs/lint/with_glob_config/glob/nested/foo/bar.ts index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/nested/foo/bar.ts +++ b/tests/specs/lint/with_glob_config/glob/nested/foo/bar.ts @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/testdata/lint/glob/nested/foo/bazz.ts b/tests/specs/lint/with_glob_config/glob/nested/foo/bazz.ts similarity index 73% rename from tests/testdata/lint/glob/nested/foo/bazz.ts rename to tests/specs/lint/with_glob_config/glob/nested/foo/bazz.ts index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/nested/foo/bazz.ts +++ b/tests/specs/lint/with_glob_config/glob/nested/foo/bazz.ts @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/specs/lint/with_glob_config/glob/nested/foo/fizz.ts b/tests/specs/lint/with_glob_config/glob/nested/foo/fizz.ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config/glob/nested/foo/fizz.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/testdata/lint/glob/nested/foo/foo.ts b/tests/specs/lint/with_glob_config/glob/nested/foo/foo.ts similarity index 73% rename from tests/testdata/lint/glob/nested/foo/foo.ts rename to tests/specs/lint/with_glob_config/glob/nested/foo/foo.ts index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/nested/foo/foo.ts +++ b/tests/specs/lint/with_glob_config/glob/nested/foo/foo.ts @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/testdata/lint/glob/pages/[id].ts b/tests/specs/lint/with_glob_config/glob/pages/[id].ts similarity index 73% rename from tests/testdata/lint/glob/pages/[id].ts rename to tests/specs/lint/with_glob_config/glob/pages/[id].ts index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/pages/[id].ts +++ b/tests/specs/lint/with_glob_config/glob/pages/[id].ts @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/specs/lint/with_glob_config/with_glob_config_unix.out b/tests/specs/lint/with_glob_config/with_glob_config_unix.out new file mode 100644 index 0000000000..fad285cbe7 --- /dev/null +++ b/tests/specs/lint/with_glob_config/with_glob_config_unix.out @@ -0,0 +1,94 @@ +[UNORDERED_START] +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config/glob/nested/fizz/bar.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config/glob/nested/foo/foo.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config/glob/nested/fizz/foo.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config/glob/nested/foo/bar.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config/glob/data/test1.js:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config/glob/nested/foo/fizz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config/glob/nested/fizz/fizz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config/glob/pages/[id].ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config/glob/data/test1.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars +[UNORDERED_END] + + +Found 9 problems +Checked 9 files diff --git a/tests/specs/lint/with_glob_config/with_glob_config_windows.out b/tests/specs/lint/with_glob_config/with_glob_config_windows.out new file mode 100644 index 0000000000..2ba0787912 --- /dev/null +++ b/tests/specs/lint/with_glob_config/with_glob_config_windows.out @@ -0,0 +1,94 @@ +[UNORDERED_START] +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config\glob\nested\fizz\bar.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config\glob\nested\foo\foo.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config\glob\nested\fizz\foo.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config\glob\nested\foo\bar.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config\glob\data\test1.js:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config\glob\nested\foo\fizz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config\glob\nested\fizz\fizz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config\glob\pages\[id].ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config\glob\data\test1.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars +[UNORDERED_END] + + +Found 9 problems +Checked 9 files diff --git a/tests/specs/lint/with_glob_config_and_flags/__test__.jsonc b/tests/specs/lint/with_glob_config_and_flags/__test__.jsonc new file mode 100644 index 0000000000..3aed48ee87 --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "steps": [ + { + "if": "windows", + "args": "lint --config deno.glob.json --ignore=gleb/nested/**/bar.ts", + "output": "with_glob_config_and_flags_windows.out", + "exitCode": 1 + }, + { + "if": "unix", + "args": "lint --config deno.glob.json --ignore=gleb/nested/**/bar.ts", + "output": "with_glob_config_and_flags_unix.out", + "exitCode": 1 + } + ] +} diff --git a/tests/specs/lint/with_glob_config_and_flags/deno.glob.json b/tests/specs/lint/with_glob_config_and_flags/deno.glob.json new file mode 100644 index 0000000000..f6781b0d8a --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/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/tests/testdata/lint/glob/data/tes.ts b/tests/specs/lint/with_glob_config_and_flags/glob/data/tes.ts similarity index 73% rename from tests/testdata/lint/glob/data/tes.ts rename to tests/specs/lint/with_glob_config_and_flags/glob/data/tes.ts index 26f07fba54..6940729e9e 100644 --- a/tests/testdata/lint/glob/data/tes.ts +++ b/tests/specs/lint/with_glob_config_and_flags/glob/data/tes.ts @@ -1,3 +1,2 @@ function foo() { - -} \ No newline at end of file +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/data/test1.js b/tests/specs/lint/with_glob_config_and_flags/glob/data/test1.js new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/data/test1.js @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/data/test1.ts b/tests/specs/lint/with_glob_config_and_flags/glob/data/test1.ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/data/test1.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/data/test12.ts b/tests/specs/lint/with_glob_config_and_flags/glob/data/test12.ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/data/test12.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/bar.ts b/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/bar.ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/bar.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/bazz.ts b/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/bazz.ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/bazz.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/fizz.ts b/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/fizz.ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/fizz.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/foo.ts b/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/foo.ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/nested/fizz/foo.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/bar.ts b/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/bar.ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/bar.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/bazz.ts b/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/bazz.ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/bazz.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/fizz.ts b/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/fizz.ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/fizz.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/foo.ts b/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/foo.ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/nested/foo/foo.ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/glob/pages/[id].ts b/tests/specs/lint/with_glob_config_and_flags/glob/pages/[id].ts new file mode 100644 index 0000000000..6940729e9e --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/glob/pages/[id].ts @@ -0,0 +1,2 @@ +function foo() { +} diff --git a/tests/specs/lint/with_glob_config_and_flags/with_glob_config_and_flags_unix.out b/tests/specs/lint/with_glob_config_and_flags/with_glob_config_and_flags_unix.out new file mode 100644 index 0000000000..9afca955ba --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/with_glob_config_and_flags_unix.out @@ -0,0 +1,114 @@ +[UNORDERED_START] +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config_and_flags/glob/nested/fizz/bar.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config_and_flags/glob/nested/foo/bazz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config_and_flags/glob/nested/foo/foo.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config_and_flags/glob/data/test1.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config_and_flags/glob/nested/foo/bar.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config_and_flags/glob/nested/fizz/bazz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config_and_flags/glob/nested/fizz/fizz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config_and_flags/glob/nested/fizz/foo.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config_and_flags/glob/data/test1.js:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config_and_flags/glob/nested/foo/fizz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint/with_glob_config_and_flags/glob/pages/[id].ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars +[UNORDERED_END] + + +Found 11 problems +Checked 11 files diff --git a/tests/specs/lint/with_glob_config_and_flags/with_glob_config_and_flags_windows.out b/tests/specs/lint/with_glob_config_and_flags/with_glob_config_and_flags_windows.out new file mode 100644 index 0000000000..9446796ab9 --- /dev/null +++ b/tests/specs/lint/with_glob_config_and_flags/with_glob_config_and_flags_windows.out @@ -0,0 +1,114 @@ +[UNORDERED_START] +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config_and_flags\glob\nested\fizz\bar.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config_and_flags\glob\nested\foo\bazz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config_and_flags\glob\nested\foo\foo.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config_and_flags\glob\data\test1.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config_and_flags\glob\nested\foo\bar.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config_and_flags\glob\nested\fizz\bazz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config_and_flags\glob\nested\fizz\fizz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config_and_flags\glob\nested\fizz\foo.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config_and_flags\glob\data\test1.js:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config_and_flags\glob\nested\foo\fizz.ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars + + +error[no-unused-vars]: `foo` is never used + --> [WILDLINE]lint\with_glob_config_and_flags\glob\pages\[id].ts:1:10 + | +1 | function foo() { + | ^^^ + = hint: If this is intentional, prefix it with an underscore like `_foo` + + docs: https://lint.deno.land/rules/no-unused-vars +[UNORDERED_END] + + +Found 11 problems +Checked 11 files diff --git a/tests/testdata/lint/Deno.malformed.jsonc b/tests/specs/lint/with_malformed_config/Deno.malformed.jsonc similarity index 100% rename from tests/testdata/lint/Deno.malformed.jsonc rename to tests/specs/lint/with_malformed_config/Deno.malformed.jsonc diff --git a/tests/specs/lint/with_malformed_config/__test__.jsonc b/tests/specs/lint/with_malformed_config/__test__.jsonc new file mode 100644 index 0000000000..86a47eda41 --- /dev/null +++ b/tests/specs/lint/with_malformed_config/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --config Deno.malformed.jsonc", + "output": "with_malformed_config.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/with_malformed_config.out b/tests/specs/lint/with_malformed_config/with_malformed_config.out similarity index 100% rename from tests/testdata/lint/with_malformed_config.out rename to tests/specs/lint/with_malformed_config/with_malformed_config.out diff --git a/tests/testdata/lint/Deno.malformed2.jsonc b/tests/specs/lint/with_malformed_config2/Deno.malformed2.jsonc similarity index 100% rename from tests/testdata/lint/Deno.malformed2.jsonc rename to tests/specs/lint/with_malformed_config2/Deno.malformed2.jsonc diff --git a/tests/specs/lint/with_malformed_config2/__test__.jsonc b/tests/specs/lint/with_malformed_config2/__test__.jsonc new file mode 100644 index 0000000000..3210f5a595 --- /dev/null +++ b/tests/specs/lint/with_malformed_config2/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --config Deno.malformed2.jsonc", + "output": "with_malformed_config2.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/with_malformed_config2.out b/tests/specs/lint/with_malformed_config2/with_malformed_config2.out similarity index 100% rename from tests/testdata/lint/with_malformed_config2.out rename to tests/specs/lint/with_malformed_config2/with_malformed_config2.out diff --git a/tests/testdata/lint/Deno.compact.format.jsonc b/tests/specs/lint/with_report_config/Deno.compact.format.jsonc similarity index 100% rename from tests/testdata/lint/Deno.compact.format.jsonc rename to tests/specs/lint/with_report_config/Deno.compact.format.jsonc diff --git a/tests/specs/lint/with_report_config/__test__.jsonc b/tests/specs/lint/with_report_config/__test__.jsonc new file mode 100644 index 0000000000..2b5c21ccec --- /dev/null +++ b/tests/specs/lint/with_report_config/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --config Deno.compact.format.jsonc with_config/", + "output": "with_report_config_compact.out", + "exitCode": 1 +} diff --git a/tests/specs/lint/with_report_config/with_config/a.ts b/tests/specs/lint/with_report_config/with_config/a.ts new file mode 100644 index 0000000000..c378218a32 --- /dev/null +++ b/tests/specs/lint/with_report_config/with_config/a.ts @@ -0,0 +1,4 @@ +// TODO: foo +function add(a: number, b: number): number { + return a + b; +} diff --git a/tests/specs/lint/with_report_config/with_config/b.ts b/tests/specs/lint/with_report_config/with_config/b.ts new file mode 100644 index 0000000000..d5647067ea --- /dev/null +++ b/tests/specs/lint/with_report_config/with_config/b.ts @@ -0,0 +1,4 @@ +// TODO: this file should be ignored +function subtract(a: number, b: number): number { + return a - b; +} diff --git a/tests/testdata/lint/with_report_config_compact.out b/tests/specs/lint/with_report_config/with_report_config_compact.out similarity index 100% rename from tests/testdata/lint/with_report_config_compact.out rename to tests/specs/lint/with_report_config/with_report_config_compact.out diff --git a/tests/specs/lint/with_report_config_override/Deno.compact.format.jsonc b/tests/specs/lint/with_report_config_override/Deno.compact.format.jsonc new file mode 100644 index 0000000000..f3487501a8 --- /dev/null +++ b/tests/specs/lint/with_report_config_override/Deno.compact.format.jsonc @@ -0,0 +1,11 @@ +{ + "lint": { + "include": ["with_config/"], + "exclude": ["with_config/b.ts"], + "rules": { + "tags": ["recommended"], + "include": ["ban-untagged-todo"] + }, + "report": "compact" + } +} diff --git a/tests/specs/lint/with_report_config_override/__test__.jsonc b/tests/specs/lint/with_report_config_override/__test__.jsonc new file mode 100644 index 0000000000..5b1739af3b --- /dev/null +++ b/tests/specs/lint/with_report_config_override/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint --config Deno.compact.format.jsonc with_config/ --json", + "output": "with_report_config_override.out", + "exitCode": 1 +} diff --git a/tests/specs/lint/with_report_config_override/with_config/a.ts b/tests/specs/lint/with_report_config_override/with_config/a.ts new file mode 100644 index 0000000000..c378218a32 --- /dev/null +++ b/tests/specs/lint/with_report_config_override/with_config/a.ts @@ -0,0 +1,4 @@ +// TODO: foo +function add(a: number, b: number): number { + return a + b; +} diff --git a/tests/specs/lint/with_report_config_override/with_config/b.ts b/tests/specs/lint/with_report_config_override/with_config/b.ts new file mode 100644 index 0000000000..d5647067ea --- /dev/null +++ b/tests/specs/lint/with_report_config_override/with_config/b.ts @@ -0,0 +1,4 @@ +// TODO: this file should be ignored +function subtract(a: number, b: number): number { + return a - b; +} diff --git a/tests/testdata/lint/with_report_config_override.out b/tests/specs/lint/with_report_config_override/with_report_config_override.out similarity index 100% rename from tests/testdata/lint/with_report_config_override.out rename to tests/specs/lint/with_report_config_override/with_report_config_override.out diff --git a/tests/testdata/lint/expected_verbose.out b/tests/testdata/lint/expected_verbose.out deleted file mode 100644 index eb8a2651ab..0000000000 --- a/tests/testdata/lint/expected_verbose.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -Found 3 problems -Checked 3 files diff --git a/tools/lint.js b/tools/lint.js index bcbf1c27eb..e914fe159c 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -210,7 +210,6 @@ async function ensureNoNewITests() { "jsr_tests.rs": 0, "js_unit_tests.rs": 0, "jupyter_tests.rs": 0, - "lint_tests.rs": 18, // Read the comment above. Please don't increase these numbers! "lsp_tests.rs": 0, "node_compat_tests.rs": 0,