basedmypy
basedmypy copied to clipboard
require comment explaining `type: ignore` 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/