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
explicit-length-check
: Use 'non-zero': 'greater-than'
by default
#850
explicit-length-check
: Use 'non-zero': 'greater-than'
by default
#850
Conversation
if (array.length === 0) {} | ||
``` | ||
|
||
|
||
## Zero comparisons | ||
|
||
Enforce comparison with `!== 0` when checking for zero length. | ||
Enforce comparison with `=== 0` when checking for zero length. |
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.
I believe this was a typo because this section talks about zero comparisons. So I fixed it.
@@ -35,13 +35,13 @@ if (string.length < 1) {} | |||
### Pass | |||
|
|||
```js | |||
if (array.length !== 0) {} | |||
if (array.length === 0) {} |
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.
I believe this was a typo because this section talks about zero comparisons. So I fixed it.
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.
Looks good.
Note that this is a breaking change since the rule wasn't enforcing any non-zero comparison style by default before, but now it enforces the
greater-than
style.Fixes #702