Skip to main content


require the use of === and !==

ESLint Equivalent: eqeqeq

It is generally bad practice to use == for comparison instead of ===. Double operators will triger implicit type coercion and are thus not prefered. Using strict equality operators is almost always best practice.

For ergonomic reasons, this rule makes an exception for == null for comparing to both null and undefined.



foo == bar

 file.ts:1 lint/js/noDoubleEquals  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  Use === instead of ==.

    foo == bar

  == is only allowed when comparing against null.

  Suggested fix: Use ===

  - foo·==·bar
  + foo·===·bar

  This may be unsafe if you are relying on type coercion


foo == null
foo != null
null == foo
null != foo