I've read moderns apps don't use anymore semicolons, maybe in the future airbnb style too ? maybe with https://standardjs.com/ ?
I'm not sure where you've read that, and it's quite false. Using semicolons is something the vast majority of JS devs do, despite the recent rise in usage of "standardJS" - something that is not actually a standard, nor something that aligns with what the majority of JS devs do in a number of ways.
The professional and modern thing to do is not to omit optional tokens, but to always use them, since explicit > implicit.
Additionally, not using semicolons can rise a series of unexpected bugs, take this line of code for example:
var obj = {n: 1};
var a = obj
[a].forEach(item => console.log(item)) //error
This results in an error, although the expected is to log the obj.
@webmobiles We tried not using semicolons on a project. 45k lines of code later and we've seen two issues, fixable in 3 minutes. I'd recommend @ljharb to open a text editor, type 45k semicolons, each in new empty line, and show this achievement to his boss. Writing semicolons in JS is as useless as writing double semicolons for each line.
I started a new project without using semicolons and after a few days I switched back to using semicolons for a simple reason: With semicolons, you get better parser, and in case of TypeScript, compiler messages.
Let's say you have forgotten a closing parenthesis on one line and went to the next line. The compiler may tell you that it expects a comma at the end of the line for an optional parameter, but if you closed the line with a semicolon, it will tell you that it expects a closing parenthesis. Also, I find it easier to skim through the code when lines are ended with semicolons.
@omidkrad We have life critical production apps with 10'000's lines of code, I think it's around 100k now, all without semicolons. All these apps are heavily tested by test team and not a single bug could be traced back to the lack of semicolons. When a new developer joins and argues for the use of semicolons, I ask him to open a text editor and type 100k semicolons, each in new line, go to the CEO and explain to him what he achieved. Not a single one has done that and they all realized that typing useless stuff isn't productive.
@mraak punctuation isn't useless, and that kind of hostile comment, again, won't be tolerated here.
The absence of semicolon-related bugs in your codebase is anecdotal and proves nothing.
@omidkrad We have life critical production apps with 10'000's lines of code, I think it's around 100k now, all without semicolons. All these apps are heavily tested by test team and not a single bug could be traced back to the lack of semicolons. When a new developer joins and argues for the use of semicolons, I ask him to open a text editor and type 100k semicolons, each in new line, go to the CEO and explain to him what he achieved. Not a single one has done that and they all realized that typing useless stuff isn't productive.
using linter and airbnb/javascript style to stay more productive, it adds for me the semicolons automatically I am the CEO of my own company and my linter helps me to stay productive ...
Most helpful comment
Additionally, not using semicolons can rise a series of unexpected bugs, take this line of code for example:
This results in an error, although the expected is to log the obj.