New rule: no-constant-condition #563

feross opened this Issue Jul 12, 2016 · 3 comments


None yet

3 participants

feross commented Jul 12, 2016 edited

Disallow constant expressions in conditions.

This rule is overly broad by default, preventing things like while (true) with a break inside, which is really common when writing low-level modules like parsers, etc. which is why it was not enabled before now.

However, there is now a checkLoops option that can be set to false so that only things like this get checked:

if (false) {
  // ...

So I propose we enable this now.

@feross feross modified the milestone: v8 Jul 12, 2016

Ah, sometimes I use this to "trick" standard (if (true) return) with the unreachable code error during development. But overall, this is a good change 👍


Aye, works for me

@feross feross referenced this issue Jul 12, 2016

Release proposal: standard v8 #564

16 of 16 tasks complete
@feross feross added a commit to feross/eslint-config-standard that closed this issue Jul 12, 2016
@feross Disallow constant expressions in conditions (no-constant-condition) 52c1874
feross commented Jul 12, 2016

This rule will be included in standard v8

@saadq saadq referenced this issue in nodejs/ Aug 25, 2016

Update dependencies #873

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment