[ no-constant-condition] should validate 'void' too
See original GitHub issueRequest type : Enhancement
Rule : no-constant-condition
What version of ESLint are you using? 2.5.1
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
{
"rules": {
"no-constant-condition": 2 // disallow use of constant expressions in conditions
}
}
What did you do? Please include the actual source code causing the issue.
if(void x){}
if (void x === void x){}
What did you expect to happen? Error as it is a constant condition
What actually happened? No error
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:12 (11 by maintainers)
Top Results From Across the Web
no-constant-condition - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >ecmascript 6 - while(1) in JavaScript - Stack Overflow
A constant expression (for example, a literal) as a test condition might be a typo or development trigger for a specific behavior.
Read more >Linter rules - Dart
Conditions should not unconditionally evaluate to true or to false . This rule is currently deprecated and available as of Dart 2.0.0.
Read more >Don't use non-test constants in unit tests - DEV Community
One reason not to do this is that it creates a situation where when production code is refactored, tests will unnecessarily get refactored ......
Read more >void operator - JavaScript - MDN Web Docs
The void operator evaluates the given expression and then returns ... from undefined to true will not change the behavior of this code....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sounds reasonable to me. Although I think the primary case should be:
👍