https://github.com/airbnb/javascript#semicolons
In particular:
// bad - returns `undefined` instead of the value on the next line - always happens when `return` is on a line by itself because of ASI!
function foo() {
return
'search your feelings, you know it to be foo'
}
// good
function foo() {
return 'search your feelings, you know it to be foo';
}
The bad example produces an unexpected result not because of the lack of a semicolon, but the existence of a newline between return and the string as explained in the comment.
Since it has nothing to do with semicolons, I suggest that this example be removed to avoid any misconceptions..
It's a reason that ASI is bad (as is explained in the comment). ASI being bad means that you shouldn't rely on it.
Not relying on ASI means that you should put semicolons wherever the language would otherwise put one.
I think this is fine as-is. You can also refer to the language specification for a list of ASI hazards: https://tc39.es/ecma262/#sec-interesting-cases-of-automatic-semicolon-insertion
Most helpful comment
It's a reason that ASI is bad (as is explained in the comment). ASI being bad means that you shouldn't rely on it.
Not relying on ASI means that you should put semicolons wherever the language would otherwise put one.
I think this is fine as-is. You can also refer to the language specification for a list of ASI hazards: https://tc39.es/ecma262/#sec-interesting-cases-of-automatic-semicolon-insertion