-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Classify lintish diagnostics as warnings, add treatWarningsAsErrors #19126
Conversation
void x; // implicit fallthrough | ||
case "b": | ||
~~~ | ||
!!! error TS2678: Type '"b"' is not comparable to type '"a"'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't strictly related to the test, but when I went to remove it, I considered that it is useful in verifying that we're not reporting all errors as warnings.
function shouldTreatWarningsAsErrors() { | ||
const setValue = program.getCompilerOptions().treatWarningsAsErrors; | ||
if (typeof setValue === "undefined") { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice that it defaults to the safer setting (true
); but how do you disable it via command-line arguments? --no-treatWarningsAsErrors
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--treatWarningsAsErrors false
, same as our other boolean flags.
What's the rule for whether something is a warning or not? |
For future errors... Based on this pattern, non-semantic errors which aren't runtime errors but are code smells. |
I didn't check, but does the Also, I think it's desirable that the treatWarningsAsErrors applies to the exit code and on the command line, but not in the editor. |
I am not sure i understand this statement. can you elaborate? |
Wait, do you mean always still red underlines in the editor, but still allow the exit code to be |
No, right now warnings are mixed with errors, sorted by file position. Is it always desirable to split them up? Actually |
any movement here? |
@timc13 see the design notes linked above:
|
@weswigham can we close for now? |
We're not actively considering it right now, and I imagine the next time we decide to talk about this we'll waffle just as much, so sure. 😛 The real question is will you close the original issue: #13408 |
Fixes #13408
We already had the infrastructure to do this in pretty much the entire stack (heck,
pretty
output even has configured yellow text for warnings, even though in no circumstances would we have seen them before). All that was missing was the ability to toggle warnings as errors and the initial listing of the diagnostics as warnings.@mhegazy As a feature, I assume this is too late for 2.6?