Closed DAGapps closed 7 years ago
Ok, I see now that a semicolon in front of the expression is wanted and the correct way. But in my opinion, this looks really ugly. But, ok. This is not a bug. See here: http://standardjs.com/rules.html (no-unexpected-multiline)
var foo = {
'value': 42
}
console.log(foo.value)
;(function () {
return
})()
It would be better if the linter warns with: Never start a line with (, [, or ` (brackets or quotes). Start with semicolon if required.
Why do I use anonymous self-invoking expression functions?
When a self-invoking function-expression is on the bottom of a script, the linter throws a warning: 'Unexpected newline between function and ( of function call.' Because the linter does not understand that a expression bracket is standalone and assigned to the following wrapped function. Not the function or object in front.
Example:
js-standard:
You can fix this by a workaround by adding a semicolon before expression function. But this is not solution. Because extra semicolons:
js-standard:
I'm sure, this is a bug. Or what's wrong?