Since a few week, I omit semicolons in my JavaScript files. I realized today it may cause issues if the file is minifyed.
I read the following ressources:
- https://www.reddit.com/r/javascript/comments/3ykv0w/is_it_actually_true_that_minifiers_break_js_code/
- https://github.com/mrclay/minify/issues/396
- https://github.com/github/fetch/issues/420
There are two points of view:
- If a tool processes a javascript file that worked and turned it into a javascript file that doesn't work, that tool doesn't hold true to its promise of “without changing its functionality”.
- Since omiting semicolons prevent the file from being minifyed, semicolons must be added.
What is the best option in the general case? I mean by "general case" that the source code should be generic and minifyed by any minifyer.