Skip to content
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

New rule: no-constant-condition #563

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

New rule: no-constant-condition #563

feross opened this issue Jul 12, 2016 · 3 comments

Comments

@feross
Copy link
Member

feross commented Jul 12, 2016

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
Copy link
Member

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
Copy link
Contributor

Aye, works for me

@feross
Copy link
Member Author

feross commented Jul 12, 2016

This rule will be included in standard v8

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

3 participants