-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to report unnecessary pyright: ignore
comments, but not type: ignore
?
#4243
Comments
I'm reluctant to add such a feature because it's effectively working around a limitation in mypy. Mypy should provide its own way of suppressing diagnostics (a I think it's reasonable to suppress the |
I agree about mypy and I've upvoted the issue you linked. Thank you! |
This is addressed in pyright 1.1.282, which I just published. It will also be included in a future release of pylance. |
Thanks! It mostly work but there's still 1 edge case: if a mypy and pyright error do happen on the same line. I can't ignore both because both expect their ignore to be at the start of the comment. Example: class Task(Future[_T_co], Generic[_T_co]): # type: ignore[type-var] # pyright: ignore[reportGeneralTypeIssues]
# [...]
pass
// OR
class Task(Future[_T_co], Generic[_T_co]): # pyright: ignore[reportGeneralTypeIssues] # type: ignore[type-var]
# [...]
pass And I have a hunch due to discussions in python/mypy#12358 that mypy isn't the one that's gonna be able to support ignores at the end of the line. |
Alternatively a |
I consider this ticket closed. If you have additional feature requests, please open a new ticket. We're unlikely to implement "next line" or block disable. That has been suggested before and has been rejected. You could search for that issue and upvote it. We sometimes reconsider decisions if a closed issue has been upvoted by many pyright users. |
Is your feature request related to a problem? Please describe.
I would like pyright to report unecessary
pyright: ignore
comments. But completely leave alonetype: ignore
in libraries I'm validating against both mypy and pyright.The following config still reports
Unnecessary "# type: ignore" comment
With
"enableTypeIgnoreComments": true
, any# type: ignore[whatever]
will disable all pyright errors for that line. And will also report if added to a line with a mypy-only error-code.Describe the solution you'd like
A way for pyright to stop checking
# type: ignore
comments completely. (but notpyright: ignore
)The text was updated successfully, but these errors were encountered: