Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'd review the coding standards checked by <a href="http://www.javascriptlint.com/" rel="noreferrer">JSLint</a> or look at the author of <a href="https://github.com/isaacs/npm" rel="noreferrer">NPM</a> (Isaac Shlueter's) <a href="https://docs.npmjs.com/misc/coding-style" rel="noreferrer">coding standards</a>.</p> <p>You could also look at the style used by notable Node.JS coders:</p> <ul> <li><a href="https://github.com/visionmedia" rel="noreferrer">TJ Holowaychuk</a></li> <li><a href="https://github.com/isaacs" rel="noreferrer">Isaac Shlueter</a></li> <li><a href="https://github.com/creationix" rel="noreferrer">Tim Caswell</a></li> <li><a href="https://github.com/jashkenas" rel="noreferrer">Jeremy Ashkenas</a></li> <li><a href="https://github.com/felixge" rel="noreferrer">Felix Geisendörfer</a></li> <li><a href="https://github.com/indexzero" rel="noreferrer">Charlie Robbins</a></li> <li><a href="https://github.com/Marak" rel="noreferrer">Marak Squires</a></li> <li><a href="https://github.com/aheckmann" rel="noreferrer">Aaron Heckmann</a></li> <li><a href="https://github.com/guille" rel="noreferrer">Guillermo Rauch</a></li> <li><a href="https://github.com/mikeal" rel="noreferrer">Mikeal Rogers</a></li> <li><a href="https://github.com/ry" rel="noreferrer">Ryan Dahl</a> + you could look at <a href="https://github.com/joyent/node/tree/master/lib" rel="noreferrer">the actual Node.JS codebase</a></li> </ul> <p>I'll <a href="http://github.com/chriso" rel="noreferrer">throw mine</a> in there for good measure ;)</p> <p>Edit: Suggestions from <a href="https://stackoverflow.com/users/389442/alienhard">@alienhard</a></p> <ul> <li><a href="https://google.github.io/styleguide/javascriptguide.xml" rel="noreferrer">Google JavaScript style Guide</a></li> <li><a href="https://github.com/felixge/node-style-guide" rel="noreferrer">Felix's Node.js Style Guide</a></li> </ul> <p>IMO there's a few golden rules you should follow:</p> <ul> <li>Never use <code>with</code> or <code>eval</code></li> <li>Use <code>===</code> over <code>==</code></li> <li>Always declare your variables with <code>var</code> in the appropriate scope - don't fallback to the global scope</li> <li>Wrap your app in a closure <code>(function(){})()</code> if you plan on releasing code that runs server-side as well as in the browser</li> <li>Callbacks should take <code>err</code> as the first argument and if they themselves take a callback as an argument, it should be last, e.g. <code>callback(err, param1, param2, callback)</code></li> </ul> <p>Indentation, spacing between braces and keywords and semicolon placement are all a matter of preference.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload