Commit aff4ddba authored by Sindre Sorhus's avatar Sindre Sorhus

Update contributing.md with code style guidelines

parent 40f30072
...@@ -3,6 +3,43 @@ ...@@ -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). 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 ## Pull Request Guidelines
- Develop in a topic branch (not `master`) and submit against the `labs` folder in the default `gh-pages` branch - Develop in a topic branch (not `master`) and submit against the `labs` folder in the default `gh-pages` branch
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment