1
0
Fork 0
firefox/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/no-compare-against-boolean-literals.rst
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

23 lines
598 B
ReStructuredText

no-compare-against-boolean-literals
===================================
Checks that boolean expressions do not compare against literal values
of ``true`` or ``false``. This is to prevent overly verbose code such as
``if (isEnabled == true)`` when ``if (isEnabled)`` would suffice.
Examples of incorrect code for this rule:
-----------------------------------------
.. code-block:: js
if (foo == true) {}
if (foo != false) {}
if (false == foo) {}
Examples of correct code for this rule:
---------------------------------------
.. code-block:: js
if (!foo) {}
if (!!foo) {}