Allow `while(true)` loops (#1495)

The eslint no-constant-condition rule disallows while(true) loops,
since the true is a constant condition. However, I find the allowed
alternative (`for (;;)`) less readable, so I am adding the sub-rule that
allows constant conditions for loops.

Test plan: A followon commit uses a while(true) loop, and, assuming this
patch is applied, it does not result in a lint error.

Co-authored-by: Robin van Boven <497556+Beanow@users.noreply.github.com>
This commit is contained in:
Dandelion Mané 2019-12-28 15:58:43 -08:00 committed by GitHub
parent 8f32912270
commit 507091a976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -29,6 +29,7 @@ module.exports = {
caughtErrorsIgnorePattern: "^_$|^_unused_",
},
],
"no-constant-condition": ["warn", {checkLoops: false}],
"no-use-before-define": ["off"],
"no-useless-constructor": ["off"],
"no-case-declarations": ["off"],