I love pull requests. And following this simple guidelines will make your pull request easier to merge.
- Create a new branch, please don’t work in master directly.
- Add failing tests (if there’re any tests in project) for the change you want to make. Run tests (see below) to see the tests fail.
- Hack on.
- Run tests to see if the tests pass. Repeat steps 2–4 until done.
- Update the documentation to reflect any changes.
- Push to your fork and submit a pull request.
- Tab indentation.
- Single-quotes.
- Semicolons.
- No trailing whitespace.
- Variables where needed.
- Multiple variable statements.
- Space after keywords and between arguments and operators.
- Use === and !== over == and !=.
- Return early.
- Limit line lengths to 120 chars.
- Prefer readability over religion.
Example:
function foo(bar, fum) {
if (!bar) {
return;
}
var hello = 'Hello';
var ret = 0;
for (let barIdx = 0; barIdx < bar.length; barIdx++) {
if (bar[barIdx] === hello) {
ret += fum(bar[barIdx]);
}
}
return ret;
}
- If you have commit access to repository and want to make big change or not sure about something, make a new branch and open pull request.
- Don’t commit generated files: compiled from Stylus CSS, minified JavaScript, etc.
- Don’t change version number and change log.
- Install EditorConfig plugin for your code editor.
- Feel free to ask me anything you need.
Install dependencies:
npm install
Run tests:
npm test
Run tests in watch mode:
npm run test:watch
Run a style guide with examples:
npm start