Skip to content

New rule: no-constant-condition #563

Closed
@feross

Description

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.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions