Skip to content

Commit

Permalink
Link to @shama's excellent semicolons video (fix standard#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
feross committed Jul 17, 2015
1 parent bb75ca6 commit c91a46c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
7 changes: 3 additions & 4 deletions README.md
Expand Up @@ -44,14 +44,13 @@ npm install standard
- Always prefix browser globals with `window` – except `document` and `navigator` are okay
- Prevents accidental use of poorly-named browser globals like `open`, `length`,
`event`, and `name`.
- **And [more goodness][6]***give `standard` a try today!*
- **And [more goodness][5]***give `standard` a try today!*

[1]: http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding
[2]: http://inimino.org/~inimino/blog/javascript_semicolons
[3]: https://github.com/maxogden/messages/issues/18
[3]: https://www.youtube.com/watch?v=gsfbh17Ax9I
[4]: RULES.md#automatic-semicolon-insertion-asi
[5]: https://developer.mozilla.org/en-US/docs/Web/API/Window.self
[6]: RULES.md#javascript-standard-style
[5]: RULES.md#javascript-standard-style

To get a better idea, take a look at
[a sample file](https://github.com/feross/bittorrent-dht/blob/master/client.js) written
Expand Down
16 changes: 12 additions & 4 deletions RULES.md
Expand Up @@ -9,7 +9,7 @@ important rules are listed here. Please send PRs!
- **2 spaces** – for indentation
- **Single quotes for strings** – except to avoid escaping
- **No unused variables** – this one catches *tons* of bugs!
- **No semicolons**[It's][1] [fine.][2] [Really!][3]
- **No semicolons**[It's][1] [totally][2] [fine.][3] [Really!][4]
- **Never start a line with `(` or `[`**
- This is the **only** gotcha with omitting semicolons – *automatically checked for you!*
- **Space after keywords** `if (condition) { ... }`
Expand All @@ -22,7 +22,16 @@ important rules are listed here. Please send PRs!

## Automatic semicolon insertion (ASI)

*Quoting from ["An Open Letter to JavaScript Leaders Regarding Semicolons"][1]:*
##### Required reading:

- [An Open Letter to JavaScript Leaders Regarding Semicolons][1]
- [JavaScript Semicolon Insertion – Everything you need to know][2]

##### And a helpful video:

- [Are Semicolons Necessary in JavaScript? - YouTube][3]

##### Excerpt from *["An Open Letter to JavaScript Leaders Regarding Semicolons"][1]*:

[Relying on automatic semicolon insertion] is quite safe, and perfectly valid JS that every browser understands. Closure compiler, yuicompressor, packer, and jsmin all can properly minify it. There is no performance impact anywhere.

Expand Down Expand Up @@ -81,5 +90,4 @@ nums.forEach(bar)

[1]: http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding
[2]: http://inimino.org/~inimino/blog/javascript_semicolons
[3]: https://github.com/maxogden/messages/issues/18
[4]: https://developer.mozilla.org/en-US/docs/Web/API/Window.self
[3]: https://www.youtube.com/watch?v=gsfbh17Ax9I

0 comments on commit c91a46c

Please sign in to comment.