Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Created September 12, 2014 14:17
Show Gist options
  • Save ajcrites/a480d629e4af411fb541 to your computer and use it in GitHub Desktop.
Save ajcrites/a480d629e4af411fb541 to your computer and use it in GitHub Desktop.

The highly tentative Mobiquity JavaScript style guide

  1. 4 space soft tab
  2. Always use braces for conditionals/loops
  3. Opening brace follows conditional/loop closing paren, else is on same line
  4. No leading comma
  5. Always trailing comma (for array and object literals)
  6. gulp
  7. var declarations must be made before anything else within a given scope
  8. var varFunction = function () {} <- space between paren and brace
  9. function namedFunction() {} <- no space between paren and brace
  10. if (condition) { <- space between if and paren
  11. calledFunction() <- no space between function name and paren
  12. functions intended to be instantiated with new must be capitalized. Instances are camelCase.
  13. " double quotes for strings
  14. concatenation operator must lead a new line
  15. Chained functions with callbacks should have closing brace/paren at left-most possible indentation
  16. Leftmost semicolon to avoid trailing indentation.
  17. "use strict", I guess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment