Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected '===' and instead saw '=='. (eqeqeq) #76

Open
BSravanthi opened this issue Nov 16, 2018 · 7 comments
Open

Expected '===' and instead saw '=='. (eqeqeq) #76

BSravanthi opened this issue Nov 16, 2018 · 7 comments

Comments

@BSravanthi
Copy link
Contributor

It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=. The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true: [] == false [] == ![] 3 == "03" If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot. You can choose the equlityStyle you prefer, either "smart" or "allow-null"

"smart" This option enforces the use of === and !== except for these cases:
    Comparing two literal values
    Evaluating the value of typeof
    Comparing against null

"allow-null" This option will enforce === and !== in your code with one exception - it permits comparing to null to check for null or undefined in a single expression.
//Smart:
//Good:
	typeof foo === 'undefined'
	'hello' !== 'world'
	0 === 0
	true === true
	foo === null
//Bad:
	a == b 
	foo == true
	bananas != 1
	value == undefined

Please refer to the following link to fix similar issues.
https://app.codacy.com/app/BSravanthi/pattern-recognition-iiith/issues?&filters=W3siaWQiOiJMYW5ndWFnZSIsInZhbHVlcyI6W251bGxdfSx7ImlkIjoiQ2F0ZWdvcnkiLCJ2YWx1ZXMiOlsiRXJyb3IgUHJvbmUiXX0seyJpZCI6IkxldmVsIiwidmFsdWVzIjpbbnVsbF19LHsiaWQiOiJQYXR0ZXJuIiwidmFsdWVzIjpbMTY2MV19LHsiaWQiOiJBdXRob3IiLCJ2YWx1ZXMiOltudWxsXX0seyJ2YWx1ZXMiOltdfV0=

@DevikaBoddu
Copy link

Commit id: c2a2881-exp2
Commit id: 903d72f-exp5
Commit id: a1ae248-exp7

This was referenced Nov 26, 2018
@ShivaniKomandury
Copy link

Commit id : 0075c8b
Commit id : 127f2e9
Commit id : a39dc2a

Please validate.

@VINEETHREDDYSHERI
Copy link

Valid fix @ShivaniKomandury

1 similar comment
@snehitharangu
Copy link

Valid fix @ShivaniKomandury

@somashekhar31
Copy link

somashekhar31 commented Dec 2, 2018

validated-2 fix @ShivaniKomandury

@somashekhar31
Copy link

commit id:ce23792

@kasyapbhuvanagiri
Copy link

kasyapbhuvanagiri commented Dec 4, 2018

commit id: 9ad2c6f

@DevikaBoddu DevikaBoddu mentioned this issue Dec 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants