basedmypy icon indicating copy to clipboard operation
basedmypy copied to clipboard

require comment explaining `type: ignore` comments

Open DetachHead opened this issue 2 years ago • 2 comments

incorrect:

def foo():
    a: str = 1  # type: ignore[assignment] # error: add a comment on the line above explaining why the error is being ignored

correct:

def foo():
    # false positive, see https://github.com/KotlinIsland/basedmypy/issues/252
    a: str = 1  # type: ignore[assignment]

eslint has a rule for this: https://typescript-eslint.io/rules/ban-ts-comment/

DetachHead avatar Nov 03 '23 01:11 DetachHead