You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vara=1if(a){console.log('do something')}varb=3console.log(b);(function(){console.log('do another thing')})()
Runs fine, no standard errors either.
Now consider this program:
vara=1if(a){console.log('do something')};(function(){console.log('do another thing')})()
Runs fine, but standard prints the unnecessary semicolon error. While standard is indeed correct that the program and IIFE is fine without the semicolon prefix, the rule seems to be a bit too tight in this context. By default, I always prefix my IIFE with a ; so that I don't have to think of the contextual situations when it's necessary and when it is not. Do others do this? Is this a rule that should be relaxed? I'm guessing it's an eslint change.
Either way, this feels pretty low-priority to the other standard issues, but I thought that I'd bring it up for discussion.
Loving standard btw :)
The text was updated successfully, but these errors were encountered:
You're right – this is a weird edge case and it's inconsistent. In the second example eslint is complaining because ; is not required after an if statement block. We could fix this by disabling the no-extra-semi rule.
Consider this program:
Runs fine, no
standard
errors either.Now consider this program:
Runs fine, but
standard
prints theunnecessary semicolon
error. Whilestandard
is indeed correct that the program and IIFE is fine without the semicolon prefix, the rule seems to be a bit too tight in this context. By default, I always prefix my IIFE with a;
so that I don't have to think of the contextual situations when it's necessary and when it is not. Do others do this? Is this a rule that should be relaxed? I'm guessing it's aneslint
change.Either way, this feels pretty low-priority to the other standard issues, but I thought that I'd bring it up for discussion.
Loving
standard
btw :)The text was updated successfully, but these errors were encountered: