-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Base rule extension: [no-constant-binary-condition] Remove the parts of the rule that TypeScript also reports on #9973
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
Comments
My immediate question when I read those release notes, and my question for this issue, is - how does |
That is a great question. Are there any cases that |
Idk, that's my question 🤷♂️😂 |
Also, is the TS design pure syntactic analysis, or does it take into account types? 🤷♂️ |
I poked around a bit. It's >=99% covered by For now, we can just turn off |
Is there rush to do remove it from recommended set? I mean, it’s not big issue if it’s removed from recommended set as used can add it back. But I think many will not read changelog to notice this. Typescript 5.6 just released so I there are probably bunch of projects that have not updated yet or can’t update for few months. no-unnecessary-condition is nice but it needs strict null checks if I understood correctly? Maybe what I would suggest is to merge the change when Typescript 5.7 is released? (Or about there, just give a little bit more time for people to benefit this rule if they are not using 5.6 yet) :) I know that Angular users are small minority but as far as I understood, only Angular 19 will support Typescript 5.6 and its release is scheduled to “Week of 2024-11-19” |
I would tend to agree - I don't think there's any great rush. From experience the errors that these checks reveal are very much few and far between. They're real bugs but they don't occur often enough for us to rush out a disable to deduplicate the errors. And anyways - double reporting on these things ain't bad cos they are real, provable bugs in the code. |
👍 closing for now. We can revisit in a year or two once TS<5.5 is much less common. |
Before You File a Proposal Please Confirm You Have Done The Following...
My proposal is suitable for this project
Link to the base rule
https://eslint.org/docs/latest/rules/no-constant-binary-expression
Description
Coming over from https://devblogs.microsoft.com/typescript/announcing-typescript-5-6/#disallowed-nullish-and-truthy-checks1 -> #9653: TypeScript now includes a "Disallowed Nullish and Truthy Checks" feature. The blog post says:
Shall we write an extension rule that only reports on what TypeScript doesn't?
Fail
Pass
Additional Info
💖
The text was updated successfully, but these errors were encountered: