Skip to content
This repository was archived by the owner on Jun 25, 2019. It is now read-only.

Standards

serby edited this page Sep 12, 2012 · 6 revisions

Browser Support

Front end

Ideally responsive mobile first design

  • IE 7 first class Support
  • Firefox 3.6+
  • Chrome Recent-1
  • Safari Recent-1

Admin

  • IE 8 First class Support
  • Firefox 3.6+
  • Chrome Recent-1
  • Safari Recent-1

Comma First

Use comma first for all variable declarations. It is up to you if you want to conform to the true comma first style (see https://gist.github.com/357981), I'll let you know when I have made up my mind on this one. Currently I'm trying to always us it.

Testing

Use mocha for testing and should as an assertion framework. Create small mocked unit tests wherever possible and not integration tests that require actual IO.

Callbacks

Always observe the node.js convention of having error as the first argument of any callback.

myFn(function (error, data) {
  if (error) {
    // Bad
  }
  console.log(data);
});

functions

Always give functions names to help debugging a stack trace. Also try and put a space after the name of the 'function' reserve word.

module.exports = function getProperties (environment) {
};

Modules

Ideally each module should only return one function. See example above.

Files

Filenames should be all lowercase and if possible a single word

 model.js
 server.js

If you need to join words use '-'

view-config.js
http-error.js

Try and make file names nouns without including verb parts.

Quotes

JavaScript use '

Stylus use "

Jade use '

Json use "

Clone this wiki locally