Feature Request: support # pyright: ignore
not at the start of a comment
#4259
Labels
addressed in next version
Issue is fixed and will appear in next published version
enhancement request
New feature or request
Is your feature request related to a problem? Please describe.
Some tools (pyright included) expect their special keyword in a comment to be at the start of a comment. This can be problematic if two of those tools need a comment on the same line.
One such other example (with a high risk of collision), is mypy (for example to validate that a library will pass both checkers). I can't ignore both pyright and mypy if they have an error on the same line and
enableTypeIgnoreComments
is turned off (to separate mypy issues from pyright issues in the first place)Same line doesn't even necessarily mean same error. But certain formatters (like black), will force everytihing on a line until the set limit.
Example (neither will work):
Describe the solution you'd like
One solution is support
# pyright: ignore
even if it's not at the start of the comment.For instance, pylint, bandit, flake8, isort all do it to avoid this exact kind of issue:
And given discussions in python/mypy#12358 , I don't think mypy is going to be able to support ignores at the end of the line anytime soon.
Additional context
Other possible solutions (but already declined) include block-level comments: #2607
and a "next-line" ignore.
The text was updated successfully, but these errors were encountered: