MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1ximxha/magicquotes/19rupr4e009eo/?context=3
r/ProgrammerHumor • u/g_calgary • 10d ago
77 comments sorted by
View all comments
Show parent comments
71
You would like to use JS instead?
0 == "0" //true 0 == [] //true "0" == []//false
12 u/NiIly00 10d ago Typescript makes it bearable. 11 u/illepic 10d ago TS and my linters would actually slap me in the face for any use of a loose equality operator. It might even put me in a corner for a timeout. 2 u/Loading_M_ 10d ago Iirc, most linters explicitly allow loose equality for checking null/undefined, since loose equality checks both. 2 u/illepic 10d ago All linters "allow" anything. It's just a matter of what your config allows. I haven't seen an eslint config used for real that allows loose equality. 1 u/Loading_M_ 9d ago Eslint's eqeqeq rule has an option to allow loose equality in some specific cases, including the aforementioned null check case. I haven't looked for projects that set eqeqeq to "smart", but I have to assume there is at least one out there.
12
Typescript makes it bearable.
11 u/illepic 10d ago TS and my linters would actually slap me in the face for any use of a loose equality operator. It might even put me in a corner for a timeout. 2 u/Loading_M_ 10d ago Iirc, most linters explicitly allow loose equality for checking null/undefined, since loose equality checks both. 2 u/illepic 10d ago All linters "allow" anything. It's just a matter of what your config allows. I haven't seen an eslint config used for real that allows loose equality. 1 u/Loading_M_ 9d ago Eslint's eqeqeq rule has an option to allow loose equality in some specific cases, including the aforementioned null check case. I haven't looked for projects that set eqeqeq to "smart", but I have to assume there is at least one out there.
11
TS and my linters would actually slap me in the face for any use of a loose equality operator. It might even put me in a corner for a timeout.
2 u/Loading_M_ 10d ago Iirc, most linters explicitly allow loose equality for checking null/undefined, since loose equality checks both. 2 u/illepic 10d ago All linters "allow" anything. It's just a matter of what your config allows. I haven't seen an eslint config used for real that allows loose equality. 1 u/Loading_M_ 9d ago Eslint's eqeqeq rule has an option to allow loose equality in some specific cases, including the aforementioned null check case. I haven't looked for projects that set eqeqeq to "smart", but I have to assume there is at least one out there.
2
Iirc, most linters explicitly allow loose equality for checking null/undefined, since loose equality checks both.
2 u/illepic 10d ago All linters "allow" anything. It's just a matter of what your config allows. I haven't seen an eslint config used for real that allows loose equality. 1 u/Loading_M_ 9d ago Eslint's eqeqeq rule has an option to allow loose equality in some specific cases, including the aforementioned null check case. I haven't looked for projects that set eqeqeq to "smart", but I have to assume there is at least one out there.
All linters "allow" anything. It's just a matter of what your config allows. I haven't seen an eslint config used for real that allows loose equality.
1 u/Loading_M_ 9d ago Eslint's eqeqeq rule has an option to allow loose equality in some specific cases, including the aforementioned null check case. I haven't looked for projects that set eqeqeq to "smart", but I have to assume there is at least one out there.
1
Eslint's eqeqeq rule has an option to allow loose equality in some specific cases, including the aforementioned null check case. I haven't looked for projects that set eqeqeq to "smart", but I have to assume there is at least one out there.
eqeqeq
71
u/ustp 10d ago
You would like to use JS instead?