KotlinIsland / KotlinIsland/basedmypy

require comment explaining `type: ignore` comments

Open
#571 2 comments 2 reactions 0 assignees View on GitHub
feature
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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

correct:
```py
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/

Contributor guide

Open the contributing guide

Research direction

Start by locating the handling of `# type: ignore` comments and review the issue’s incorrect and correct examples alongside the linked ESLint rule. Done means an ignored error requires an explanatory comment on the preceding line, while the documented valid form remains accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.