diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/lint/expected.out | 36 | ||||
-rw-r--r-- | cli/tests/lint/file1.js | 3 | ||||
-rw-r--r-- | cli/tests/lint/file2.ts | 9 | ||||
-rw-r--r-- | cli/tests/lint/ignored_file.ts | 3 |
5 files changed, 57 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 2da5eebcb..d70527881 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1939,6 +1939,12 @@ itest!(proto_exploit { output: "proto_exploit.js.out", }); +itest!(deno_lint { + args: "lint --unstable lint/file1.js lint/file2.ts lint/ignored_file.ts", + output: "lint/expected.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 new file mode 100644 index 000000000..0b0654298 --- /dev/null +++ b/cli/tests/lint/expected.out @@ -0,0 +1,36 @@ +(no-var) `var` keyword is not allowed +var a = 1, +~~~~~~~~~~ + 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 +} catch (e) {} + ~~ + at [WILDCARD]file2.ts:3:12 + +(ban-unused-ignore) Ignore for code "require-await" was not used. +// deno-lint-ignore no-explicit-any require-await +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + at [WILDCARD]file2.ts:5:0 + +(no-empty-function) Empty functions are not allowed +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 diff --git a/cli/tests/lint/file1.js b/cli/tests/lint/file1.js new file mode 100644 index 000000000..d74b6f47a --- /dev/null +++ b/cli/tests/lint/file1.js @@ -0,0 +1,3 @@ +var a = 1, + b = 2, + c = 3; diff --git a/cli/tests/lint/file2.ts b/cli/tests/lint/file2.ts new file mode 100644 index 000000000..f0f3a3ba3 --- /dev/null +++ b/cli/tests/lint/file2.ts @@ -0,0 +1,9 @@ +try { + await Deno.open("./some/file.txt"); +} catch (e) {} + +// deno-lint-ignore no-explicit-any require-await +function foo(): any {} + +// deno-lint-ignore +while (false) {} diff --git a/cli/tests/lint/ignored_file.ts b/cli/tests/lint/ignored_file.ts new file mode 100644 index 000000000..97befafa3 --- /dev/null +++ b/cli/tests/lint/ignored_file.ts @@ -0,0 +1,3 @@ +// deno-lint-ignore-file + +function foo(): any {} |