virtual-labs / structural-dynamics-iiith-ph2

Other
0 stars 74 forks source link

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

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/structural-dynamics-iiith/issues?&filters=W3siaWQiOiJMYW5ndWFnZSIsInZhbHVlcyI6W251bGxdfSx7ImlkIjoiQ2F0ZWdvcnkiLCJ2YWx1ZXMiOlsiRXJyb3IgUHJvbmUiXX0seyJpZCI6IkxldmVsIiwidmFsdWVzIjpbbnVsbF19LHsiaWQiOiJQYXR0ZXJuIiwidmFsdWVzIjpbMTY2MV19LHsidmFsdWVzIjpbXX1d

SadhuSantosh commented 5 years ago

Commit id: fa23e32-1 Commit id: 1fcfdfb-2 Commit id: ee89226-3 Commit id: 6cf1d3b-4 Commit id: 710e741-5 Commit id: a6aa7a6-6 Commit id: 86e2f8b-7 Commit id: 37205c0-8 Commit id: b13fab2-9 Commit id: ab02282-10 Commit id: 97cbe18-11 Commit id: b2542aa-12 Commit id: 1c6e012-13 Commit id: 447b937-14 Commit id: 5e76bdc-15 Commit id: 2bca840-16 Commit id: 8b9663a-17

DevikaBoddu commented 5 years ago

Validated :@sadhusantosh1999

SakethMattupalli commented 5 years ago

Valid fix @sadhusantosh1999

VINEETHREDDYSHERI commented 5 years ago

Valid fix @sadhusantosh1999

ShivaniKomandury commented 5 years ago

valid fix @sadhusantosh1999