r/ProgrammerHumor • • Oct 29 '26

Meme magicQuotes

Post image
2.4k Upvotes

77 comments sorted by

View all comments

Show parent comment

11

u/illepic Oct 29 '26

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.

5

u/Foorinick Oct 29 '26

Just make it connect to a shock collar for quicker feedback and longer lesson reminding smh my head 

2

u/Loading_M_ Oct 29 '26

Iirc, most linters explicitly allow loose equality for checking null/undefined, since loose equality checks both.

2

u/illepic Oct 30 '26

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_ Oct 30 '26

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.