Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Ideally this lint would ignore if (false) and if (true), even though these are still constant binary expressions,

I don't think they are: binary expressions affected are expressions constructed with binary logical or comparison operator (==, ===, &&, ||, ??).

true and false each aren't binary expressions, they are simple constant values, and the lint isn't for constant conditionals.

(The rule for that is no-constant-condition.)



Exactly right. And no-constant-expression is configurable to allow trivial constant expressions for exactly the reason the parent commenter raised.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: