Lint Rules

noDoubleEquals (since v0.7.0)

This rule is recommended by Rome.

Require the use of === and !==

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.

Examples

Invalid

foo == bar
correctness/noDoubleEquals.js:1:5 lint/correctness/noDoubleEquals  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━

   Use === instead of ==
  
  > 1 │ foo == bar
       ^^
    2 │ 
  
   == is only allowed when comparing against null
  
  > 1 │ foo == bar
       ^^
    2 │ 
  
   Using === may be unsafe if you are relying on type coercion
  
   Suggested fix: Use ===
  
    1 │ foo·===·bar
        +    

Valid

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