[英]Is there a TSLint Rule to check for single equals?
In my code I got a bunch of bugs lately due to typing things like if(a = b)
.在我的代码中,由于键入诸如
if(a = b)
类的内容,我最近遇到了一堆错误。
This may sound silly, but I really do need a rule to get rid of this.这听起来可能很愚蠢,但我确实需要一个规则来摆脱它。 especially when I type
array.find(val => val.id = 0)
.特别是当我输入
array.find(val => val.id = 0)
。
I know that there is a rule to enforce boolean expressions in simple statements like if and for and so on... But is there also a rule which enforces the same in like funtions?我知道有一条规则可以在 if 和 for 等简单语句中强制执行布尔表达式......但是是否也有一条规则在类似函数中强制执行相同的规则?
您可以在tslint.json
文件中添加"triple-equals": true
以强制执行tslint.json
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.