Skip to content

Contribution Requirement

Vitali Malinouski edited this page Feb 5, 2015 · 11 revisions

Your contributions are welcome and appreciated. However, I would like to lay down a few requirements to save your time (and mine) when you submit a pull request.

  1. Do not submit contributions with pure code-refactoring that provides no benefits of speed or features. I know you want the code to look "your" way, so do I.

  2. Bug fixes, small enhancements, some refactoring (where it makes sense) are welcome and it is the way most people contribute.

  3. If your changes are involved or you want to add some awesome new feature, talk to me before coding. It might save you lot of energy talking to me afterwards in your pull request.

  4. Make sure your branch is up-to-date with current master.

  5. Follow same code-style guidelines used in the files

Style Guide

I like my code to look pretty, and for your contribution to make it you need to make it look pretty. You can use any general style guide (for example https://github.com/airbnb/javascript). In particular I also look for this

  1. Formatting:
  • indentation with spaces (4 spaces per tab stop)
  • no lines with more then 120-140 chars
  • do not use more then 1 consecutive empty line
  • use function definition instead of function expression
  • keep nested functions after return where possible
  1. Align variables and properties nicely

    // GOOD
    var some  = null;
    var other = null;
    var ok    = null;
    var obj   = {
       prop1    : 1,
       otherVar : 2,
       prop3    : 3
    };
    // BAD
    var some = null;
    var other = null;
    var ok= null;
    var obj = {
       prop1: 1,
       otherProp2: 2,
       prop3: 3
    }
  2. Conditional statements

    // GOOD
    if (some condition) {
    	...
    } else {
    	...
    }

    Anything else is bad.

    • always use space after "if" and before "("
    • always use { and } (except when the whole statement is one line)
  3. Always use space after comma, semicolon:

    // GOOD
    function name(param1, param2, param3) {
       ...
    }
    // BAD
    function name(param1,param2,param3){
       ...
    }
  4. Comments: alway put space after // or /* and before */

    // GOOD
    //BAD

I will add more as I encounter them.

Clone this wiki locally