New rule: no-constant-condition #563

Closed
feross opened this Issue Jul 12, 2016 · 3 comments

Projects

None yet

3 participants

@feross
Owner
feross commented Jul 12, 2016 edited

Disallow constant expressions in conditions.

http://eslint.org/docs/rules/no-constant-condition

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
@jprichardson
Collaborator

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 👍

@yoshuawuyts
Collaborator

Aye, works for me

@feross feross referenced this issue Jul 12, 2016
Closed

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
Owner
feross commented Jul 12, 2016

This rule will be included in standard v8

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

Update dependencies #873

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