deno_lint logodeno_lint

All rules/no-constant-condition

Disallows the use of a constant expression in conditional test

Using a constant expression in a conditional test is often either a mistake or a temporary situation introduced during development and is not ready for production.


if (true) {}
if (2) {}
do {} while (x = 2); // infinite loop


if (x) {}
if (x === 0) {}
do {} while (x === 2);