From e4e332abbbe0dbdb44305a261f9965ba89e7767b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 10 Jun 2020 23:29:48 +0200 Subject: feat(lint): use default globs, upgrade to v0.1.9 (#6222) This commit: * added default file globs so "deno lint" can be run without arguments (just like "deno fmt") * added test for globs in "deno lint" * upgrade "deno_lint" crate to v0.1.9 --- cli/tests/integration_tests.rs | 6 ++++++ cli/tests/lint/expected.out | 26 ++++++++------------------ cli/tests/lint/expected_glob.out | 2 ++ cli/tests/lint/file1.js | 5 ++--- cli/tests/lint/file2.ts | 3 --- cli/tests/std_lint.out | 3 +++ 6 files changed, 21 insertions(+), 24 deletions(-) create mode 100644 cli/tests/lint/expected_glob.out create mode 100644 cli/tests/std_lint.out (limited to 'cli/tests') diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index fafce3eb0..e3f4bd085 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1957,6 +1957,12 @@ itest!(deno_lint { exit_code: 1, }); +itest!(deno_lint_glob { + args: "lint --unstable lint/", + output: "lint/expected_glob.out", + exit_code: 1, +}); + #[test] fn cafile_fetch() { use url::Url; diff --git a/cli/tests/lint/expected.out b/cli/tests/lint/expected.out index 0b0654298..57af15971 100644 --- a/cli/tests/lint/expected.out +++ b/cli/tests/lint/expected.out @@ -1,12 +1,12 @@ -(no-var) `var` keyword is not allowed -var a = 1, -~~~~~~~~~~ +(ban-untagged-ignore) Ignore directive requires lint rule code +// deno-lint-ignore +~~~~~~~~~~~~~~~~~~~ at [WILDCARD]file1.js:1:0 -(single-var-declarator) Multiple variable declarators are not allowed -var a = 1, -~~~~~~~~~~ - at [WILDCARD]file1.js:1:0 +(no-empty) Empty block statement +while (false) {} + ~~ + at [WILDCARD]file1.js:2:14 (no-empty) Empty block statement } catch (e) {} @@ -23,14 +23,4 @@ function foo(): any {} ~~~~~~~~~~~~~~~~~~~~~~ at [WILDCARD]file2.ts:6:0 -(ban-untagged-ignore) Ignore directive requires lint rule code -// deno-lint-ignore -~~~~~~~~~~~~~~~~~~~ - at [WILDCARD]file2.ts:8:0 - -(no-empty) Empty block statement -while (false) {} - ~~ - at [WILDCARD]file2.ts:9:14 - -Found 7 problems +Found 5 problems diff --git a/cli/tests/lint/expected_glob.out b/cli/tests/lint/expected_glob.out new file mode 100644 index 000000000..3e3ebd649 --- /dev/null +++ b/cli/tests/lint/expected_glob.out @@ -0,0 +1,2 @@ +[WILDCARD] +Found 5 problems diff --git a/cli/tests/lint/file1.js b/cli/tests/lint/file1.js index d74b6f47a..737f26818 100644 --- a/cli/tests/lint/file1.js +++ b/cli/tests/lint/file1.js @@ -1,3 +1,2 @@ -var a = 1, - b = 2, - c = 3; +// deno-lint-ignore +while (false) {} diff --git a/cli/tests/lint/file2.ts b/cli/tests/lint/file2.ts index f0f3a3ba3..10c709ba2 100644 --- a/cli/tests/lint/file2.ts +++ b/cli/tests/lint/file2.ts @@ -4,6 +4,3 @@ try { // deno-lint-ignore no-explicit-any require-await function foo(): any {} - -// deno-lint-ignore -while (false) {} diff --git a/cli/tests/std_lint.out b/cli/tests/std_lint.out new file mode 100644 index 000000000..9d62fcc67 --- /dev/null +++ b/cli/tests/std_lint.out @@ -0,0 +1,3 @@ +[WILDCARD] + +Found [WILDCARD] problems \ No newline at end of file -- cgit v1.2.3