Permalink
Browse files

Update contributing.md with code style guidelines

  • Loading branch information...
1 parent 40f3007 commit aff4ddbadc964a424db1ec94f830f738ec3ff891 @sindresorhus sindresorhus committed Dec 12, 2012
Showing with 37 additions and 0 deletions.
  1. +37 −0 contributing.md
View
@@ -3,6 +3,43 @@
We're happy to accept contributions in the form of new apps, bug fixes, issues, etc. If you want to help out, add a comment on the issue you want to work on and start hacking. Please open an issue for discussion before submitting framework combinations (eg. Backbone + RequireJS).
+## Code Style
+
+- Tab indentation
+- Single-quotes
+- Semicolon
+- No trailing whitespace
+- Variables at the top of the scope
+- Multiple variable statements
+- Space after keywords and between arguments and operators
+- Return early
+- JSHint valid
+- Consistency
+
+Example:
+
+```js
+function foo(bar, fum) {
+ var i, l, ret;
+ var hello = 'Hello';
+
+ if (!bar) {
+ return;
+ }
+
+ for (i = 0, l = bar.length; i < l; i++) {
+ if (bar[i] === hello) {
+ ret = fum(out);
+ }
+ }
+
+ return ret;
+}
+```
+
+Read [idiomatic.js](https://github.com/rwldrn/idiomatic.js) for general JavaScript code style best practices.
+
+
## Pull Request Guidelines
- Develop in a topic branch (not `master`) and submit against the `labs` folder in the default `gh-pages` branch

0 comments on commit aff4ddb

Please sign in to comment.