Skip to content

"Style Guide"

Brandon Aaskov edited this page Jul 3, 2013 · 1 revision
  1. Use common sense
  2. Try and make it read like english as best you can (leverage Underscore's methods to help)
  3. Fail fast: in your functions, check first for the failure cases (and throw helpful errors) and then move on to the functionality. It reads better (fewer else blocks) and really promotes the "fail fast" mentality
  4. No single variable names: can't stress that enough
  5. Use descriptive variable/function names: everything is getting minified in the end, so use long names to make it really obvious what the variable/function is for
  6. Write tests: there's a test folder and there should (eventually, anyway) be a matching js file for each module
  7. Write good tests: don't half-ass it
  8. IE Support: 8.0 and greater
  9. Anything asynchronous should use Promises (currently using the jQuery Deferred object)
  10. Modules that return functions should be named with a capital letter
  11. Modules that return objects should surface the API through that object (see most modules for examples)
  12. Check the utils module for helper methods, some of which are mixed into Underscore