diff --git a/example/src/BUILD.bazel b/example/src/BUILD.bazel index 1f0b203f..c50b9d7d 100644 --- a/example/src/BUILD.bazel +++ b/example/src/BUILD.bazel @@ -39,6 +39,7 @@ ts_project( srcs = ["file-dep.ts"], declaration = True, transpiler = "tsc", + tsconfig = ":tsconfig", deps = [], ) diff --git a/example/src/file.ts b/example/src/file.ts index 51ed3a99..8bb211e5 100644 --- a/example/src/file.ts +++ b/example/src/file.ts @@ -19,3 +19,9 @@ console.log(`Hello at ${dayjs().format("HH:mm:ss")}`); const greeting = new Greeter().greet("world"); console.log(greeting); + +// This will trigger @typescript-eslint/no-floating-promises because we're not handling the promise +async function delayedGreet() { + return greeting; +} +delayedGreet(); diff --git a/example/test/lint_test.bats b/example/test/lint_test.bats index f879d82d..d6432ef3 100755 --- a/example/test/lint_test.bats +++ b/example/test/lint_test.bats @@ -34,8 +34,10 @@ EOF # ESLint echo <<"EOF" | assert_output --partial src/file.ts - 2:7 error Type string trivially inferred from a string literal, remove type annotation @typescript-eslint/no-inferrable-types + 6:7 error Type string trivially inferred from a string literal, remove type annotation @typescript-eslint/no-inferrable-types EOF + # The tsconfig must be properly included + refute_output --partial "couldn't find any tsconfig.json" # If type declarations are missing, the following errors will be reported refute_output --partial '@typescript-eslint/no-unsafe-call' refute_output --partial '@typescript-eslint/no-unsafe-member-access' @@ -70,9 +72,13 @@ EOF echo <<"EOF" | assert_output --partial --- a/src/file.ts +++ b/src/file.ts -@@ -1,3 +1,3 @@ - // this is a linting violation +@@ -3,7 +3,7 @@ + + import { Greeter } from "./file-dep"; + +-// this is a linting violation -const a: string = "a"; ++// this is a linting violation, and is auto-fixed under `--fix` +const a = "a"; console.log(a); EOF