Semicolons
Trailing semicolons
- Yup. eslint:
semi
jscs:requireSemicolons
// bad
(function () {
const name = 'Skywalker'
return name
})()
// good
(() => {
const name = 'Skywalker';
return name;
}());
Leading semicolons
- yup for IIFEs
Why? guards against the function becoming an argument when two files with IIFEs are concatenated
// good ()
;(() => {
const name = 'Skywalker';
return name;
}());