JSHint: Allow empty return statements with ASI-Collection of common programming errors
In my JavaScript I want to have a function exit early if certain conditions are not met, like in the following example.
(function () {
var something = false
if (!something) return
doMoreStuff()
}())
I’m ommitting semicolons out of preference and it works just fine (the above snippet works as expected).
JSHint keeps giving me the error Line breaking error 'return'
. While this can be fixed by including a semicolon after the return statement, I’d rather keep semicolons out of my script.
Is there any option I can set to allow for an empty return at the end of a line without a semicolon?
Originally posted 2013-11-09 21:39:45.