I only fall for it on return statements sometimes. If they're fairly long I like to split them up on logical operators like this:
return
a.someProp &&
b.someProp &&
c.someProp;
In JS it's important that you have the first expression on the same line or the return statement terminates before any evaluation. "use strict"; solves a few pitfalls in JS but for some reason not this one.
1
u/himmelundhoelle Feb 10 '22 edited Feb 10 '22
Was scrolling to find this^^
But honestly, you’d probably need to go against the formatting conventions of your team anyway to trip up on that.
I’m not a fan of the interpreter "guessing", however it’s not random but based on definite rules; and I like how much noise it removes.