-
Notifications
You must be signed in to change notification settings - Fork 885
add allow-undefined-check option to triple-equals rule #602
Comments
Sure, that sounds like a reasonable feature request. Just want to point out, though -- those coding guidelines are for the compiler source code, not all TypeScript projects in general. |
That's absolutely right, I edited the original comment to reflect the nature of the URL more clearly. It's worth noting, though, that this is the article most likely to be the first result in search engines when looking up terms like |
If you only are using |
The only feasible use-case would be to support code-style standards where using the Sadly I can't back up this use-case with any statistical data (of how often teams decide to drop either |
Are any values besides |
As the person that brought up this change I also think that in the end it might be unnecessary. I hope this makes it easier for you to make the decision. |
Alright; i'm going to close this and leave it up to custom rules for users who want it. |
I would like to revive this issue. It was on the right track but didn't have a solid argument behind it's necessity. I'll try to augment the argument above. The What are your thoughts on this? reopen? create a new issue? still not enough of a valid reason? |
After a brief look at the compiler source, it looks like they use triple equals when comparing to @patsissons can you point me to some meaningful code that uses double equals with |
I agree with @patsissons about reopening this ticket. If you take a look at this gitbook: https://basarat.gitbooks.io/typescript/content/docs/tips/null.html there is a good argument for allowing a double equals /// Image you are doing `foo == undefined` where foo can be one of:
console.log(undefined == undefined); // true
console.log(null == undefined); // true
console.log(0 == undefined); // false
console.log('' == undefined); // false
console.log(false == undefined); // false |
@jleider ok, given those examples it looks like |
Yes exactly. |
@jleider thanks for providing that example, that was certainly the direction I was going in with this re-open request. |
is anyone claiming this one? i can probably whip up a PR for it this afternoon... |
This new option will be available in the upcoming 3.7 release. |
The official TypeScript compiler coding guidelines state:
Use
undefined
, do not usenull
Wouldn't it be beneficial to have an additional
allow-undefined-check
option for thetriple-equals
rule for developers that want to adhere to the above guidelines?The text was updated successfully, but these errors were encountered: