Suppress "Expected '===' and instead saw '=='." error in jslint

usertest picture usertest · Jun 11, 2011 · Viewed 37.4k times · Source

How can I stop the error message Expected '===' and instead saw '=='. from appearing in jslint. Doesn't seem to be an option.

Answer

bubbassauro picture bubbassauro · Oct 31, 2015

For those using JSHint, you can turn off this warning by setting the option eqeqeq to false in your JSHint options (usually .jshintrc)

"eqeqeq": false

From the documentation: http://jshint.com/docs/options/#eqeqeq

Edit:

If you want to be a good citizen and fix your code to use the recommended comparison instead of turning the warning off, make sure both sides of the comparison are using the same type.

For example:

"123" == 123          // true, I'm lazy and JSHint hates me
"123" === 123         // false, no love
Number("123") === 123 // true, no warning