virtual-labs-archive / vlsi-iiith

Other
3 stars 271 forks source link

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

Open BSravanthi opened 5 years ago

BSravanthi commented 5 years ago

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/vlsi-iiith/issues?bid=7972124&filters=W3siaWQiOiJMYW5ndWFnZSIsInZhbHVlcyI6W251bGxdfSx7ImlkIjoiQ2F0ZWdvcnkiLCJ2YWx1ZXMiOlsiRXJyb3IgUHJvbmUiXX0seyJpZCI6IkxldmVsIiwidmFsdWVzIjpbbnVsbF19LHsiaWQiOiJQYXR0ZXJuIiwidmFsdWVzIjpbMTY2MV19LHsidmFsdWVzIjpbXX1d

Pallavi98 commented 5 years ago

my commit id's: f26e0b5 f38a9d0

Gowthambhujam commented 5 years ago

Valid fix @pallavi98

VINEETHREDDYSHERI commented 5 years ago

Valid fix @Pallavi98