Skip to content

Instantly share code, notes, and snippets.

@guybrush
Forked from DanielG/guidelines.mdown
Created December 29, 2010 20:10
Show Gist options
  • Save guybrush/759005 to your computer and use it in GitHub Desktop.
Save guybrush/759005 to your computer and use it in GitHub Desktop.
  • 4 space indentation

  • 80 character max per line

  • if's always have space before braces

  • if's always have braces

      if () {
        return;
      }
    
    • exception: if (err) throw err;
  • multi command ifs must be multi line

      if (bla) {
          bla;
          doubleBla;
      }
    
    • exception: if (err) { callback(err); return; }
  • function definitions never have spaces before brackets

  • function definitions have a space before the opening brace function() { return; }

      or
      
      function bla() {
          return;
      }
    
    • exception: single line/empty function definition: function(){}
  • parameters have spaces after comma bla(b1, b2, b3);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment