Live data from Hacker News

Proposed JavaScript Standard Style

github.com

111–116 of 116 posts

Re: Proposed JavaScript Standard Style

#111
post #74

No semicolons? REALLY? We've already spoke about this, people. Let's see what Brendan Eich has to say about this: > My two cents: be careful not to use ASI as if it gave JS significant newlines. [1] and > ASI is (formally speaking) a syntactic error correction procedure. If you start to code as if it were a universal significant-newline rule, you will get into trouble. Calling it "standard JS" struck me as pretentiou…

Yes, let's see what Brendan Eich has to say about this.

https://github.com/brave/browser-laptop/blob/master/package....

^ Brendan's own company (Brave) uses `standard`, so it's clear he doesn't think omitting semicolons is so bad.

Re: Proposed JavaScript Standard Style

#112
Why is this posted under the title "Proposed JavaScript Standard Style"? I am the author of `standard` and I did not propose that this becomes any kind of official JavaScript style standard. It's just my own code standard -- you're free to use it if you want.

Re: Proposed JavaScript Standard Style

#113
post #109
post #18

Earlier quoted context omitted.

Yes, basically. I actually like the premise: > No decisions to make. That can be good, certainly Go developers benefit from the lack of bikeshedding over style. But the authors of standard didn't take this advise; they did make decisions, the ones that they prefer. If they would have just grepped through NPM to figure out the most popular style choices I would have respected the idea a bit more.

> If they would have just grepped through NPM to figure out the most popular style choices This amused me, as the npm team themselves use `standard`. https://github.com/npm/npm/blob/master/package.json#L199

Grep through the npm ecosystem, as that serves as a large sample size of what are the standard style choices. I know that npm and it's largely unreadable codebase uses your style.

Re: Proposed JavaScript Standard Style

#114
post #74

No semicolons? REALLY? We've already spoke about this, people. Let's see what Brendan Eich has to say about this: > My two cents: be careful not to use ASI as if it gave JS significant newlines. [1] and > ASI is (formally speaking) a syntactic error correction procedure. If you start to code as if it were a universal significant-newline rule, you will get into trouble. Calling it "standard JS" struck me as pretentiou…

This is the modern version of tabs vs spaces.

Re: Proposed JavaScript Standard Style

#115
post #110
post #74

No semicolons? REALLY? We've already spoke about this, people. Let's see what Brendan Eich has to say about this: > My two cents: be careful not to use ASI as if it gave JS significant newlines. [1] and > ASI is (formally speaking) a syntactic error correction procedure. If you start to code as if it were a universal significant-newline rule, you will get into trouble. Calling it "standard JS" struck me as pretentiou…

I recommend reading the following articles before you assume that omitting semicolons is dangerous. An Open Letter to JavaScript Leaders Regarding Semicolons http://blog.izs.me/post/2353458699/an-open-letter-to-javascr... JavaScript Semicolon Insertion – Everything you need to know http://inimino.org/~inimino/blog/javascript_semicolons Are Semicolons Necessary in JavaScript? https://www.youtube.com/watch?v=gsfbh17Ax9…

I know I can write a working JS application without semicolons, however I can also write a working JS application where with `eval` and `with`.

The issue is not whether or not one individual can learn to use dangerous feature X. If you are writing code by yourself for your own use, you can use nested eval's and no semicolons with a little bit of `with` here and there, nothing wrong with that. However when you are writing code that is supposed to be developed by people other than you, you might want to write less clever code.

I could write code without semicolons, however that would mean that I would have to constantly keep an eye out for that case where I absolutely need to add it to prevent ASI from doing the wrong thing. It takes probably 100ms to hit that semicolon key, however it takes a lot more time to debug code without semicolons.

If you hat semicolons with a passion for some reason, you could use Coffee Script or some other language which was designed without semicolons and has clear semantics around it.

Re: Proposed JavaScript Standard Style

#116

Earlier quoted context omitted.

No it's not, because it's not just an editor configuration, it's something in the code structure. People with different indentation working on the same files is a problem, so it's really relevant to try to set a standart about this, at least for open source project.

Yes, the code is structured with tab characters, so there is no different indentation. Only different renderings of the same semantic characters.

which lead to very useless and annoying conflict and different coding style in same files
Post reply on HN