-
Notifications
You must be signed in to change notification settings - Fork 727
Contribution Requirement
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.
-
Do not submit contributions with pure code-refactoring that provides no benefits of speed or features.
-
Bug fixes, small enhancements, some refactoring (where it makes sense) are welcome and it is the way most people start contributing.
-
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.
-
Make sure your branch is up-to-date with current master.
-
Follow same code-style guidelines used in the files
There is ESLint rules config, which is a good help for you.
I like the 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
- Formatting:
- no semicolons (except where they must be)
- 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
-
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 }
-
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)
- always use space after
-
Always use space after comma, no space before
(
and)
:// GOOD function name(param1, param2, param3) { ... }
// BAD function name(param1,param2,param3){ ... }
// BAD function name( param1,param2,param3 ){ ... }
-
Comments: alway put space after
//
or/*
and before*/
// GOOD
//BAD
I will add more as I encounter them.