ban-ts-comment
NOTE: this rule is part of the
recommended
rule set.Enable full set in
deno.json
:{ "lint": { "tags": ["recommended"] } }
Enable full set using the Deno CLI:
deno lint --tags=recommended
Disallows the use of Typescript directives without a comment.
Typescript directives reduce the effectiveness of the compiler, something which should only be done in exceptional circumstances. The reason why should be documented in a comment alongside the directive.
Invalid:
// @ts-expect-error
let a: number = "I am a string";
// @ts-ignore
let a: number = "I am a string";
// @ts-nocheck
let a: number = "I am a string";
Valid:
// @ts-expect-error: Temporary workaround (see ticket #422)
let a: number = "I am a string";
// @ts-ignore: Temporary workaround (see ticket #422)
let a: number = "I am a string";
// @ts-nocheck: Temporary workaround (see ticket #422)
let a: number = "I am a string";