vue/CONTRIBUTING.md

96 lines
3.6 KiB
Markdown
Raw Normal View History

2014-07-09 06:35:39 +08:00
# Vue.js Contributing Guide
Hi! Im really excited that you are interested in contributing to Vue.js. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
2015-05-30 11:29:31 +08:00
## Issue Reporting Guidelines
2014-07-09 06:35:39 +08:00
2015-09-22 03:37:33 +08:00
- The issue list of this repo is **exclusively** for bug reports and feature requests. For simple questions, please use either [Gitter](https://gitter.im/yyx990803/vue) or [the official forum](http://forum.vuejs.org/).
2014-07-09 06:35:39 +08:00
- Try to search for your issue, it may have already been answered or even fixed in the development branch.
2015-09-22 03:37:33 +08:00
2015-05-30 11:27:37 +08:00
- Check if the issue is reproducible with the latest stable version of Vue. If you are using a pre-release, please indicate the specific version you are using.
2015-09-22 03:37:33 +08:00
2015-08-19 06:39:03 +08:00
- It is **required** that you clearly describe the steps necessary to reproduce the issue you are running into. Issues with no clear repro steps will not be triaged. If an issue labeled "need repro" receives no further input from the issue author for more than 5 days, it will be closed.
2015-09-22 03:37:33 +08:00
2015-05-30 11:27:37 +08:00
- It is recommended that you make a JSFiddle to demonstrate your issue. You could start with [this template](http://jsfiddle.net/5sH6A/) that already includes the latest version of Vue.
2015-09-22 03:37:33 +08:00
2014-07-09 06:35:39 +08:00
- If your issue is resolved but still open, dont hesitate to close it. In case you found a solution by yourself, it could be helpful to explain how you fixed it.
2015-05-30 11:29:31 +08:00
## Pull Request Guidelines
2014-07-09 06:35:39 +08:00
- Checkout a topic branch from `dev` and merge back against `dev`.
2015-09-22 03:37:33 +08:00
2014-07-09 06:35:39 +08:00
- Work in the `src` folder and **DO NOT** checkin `dist` in the commits.
2015-09-22 03:37:33 +08:00
2014-07-09 06:35:39 +08:00
- Squash the commit if there are too many small ones.
2015-09-22 03:37:33 +08:00
2014-07-09 06:35:39 +08:00
- Follow the [code style](#code-style).
2015-09-22 03:37:33 +08:00
2014-07-09 06:35:39 +08:00
- Make sure the default grunt task passes. (see [development setup](#development-setup))
2015-09-22 03:37:33 +08:00
2014-07-09 06:35:39 +08:00
- If adding new feature:
- Add accompanying test case.
- Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it.
2015-09-22 03:37:33 +08:00
2014-07-09 06:35:39 +08:00
- If fixing a bug:
- Provide detailed description of the bug in the PR. Live demo preferred.
- Add appropriate test coverage if applicable.
## Code Style
- [No semicolons unless necessary](http://inimino.org/~inimino/blog/javascript_semicolons).
2014-07-09 13:35:20 +08:00
- Follow JSDoc.
2014-07-09 06:35:39 +08:00
- 2 spaces indentation.
- multiple var declarations.
2014-07-09 13:35:20 +08:00
- align equal signs where appropriate.
- Return early.
- 1 space after `function`
2015-05-31 01:15:37 +08:00
- 1 space between arguments, but not between parentheses.
2014-07-09 06:35:39 +08:00
- When in doubt, read the source code.
- Break long ternary conditionals like this:
2014-10-08 03:38:00 +08:00
``` js
var a = superLongConditionalStatement
? 'yep'
: 'nope'
```
2014-07-09 06:35:39 +08:00
## Development Setup
You will need [Node.js](http://nodejs.org) & [Grunt](http://gruntjs.com).
2014-07-09 06:35:39 +08:00
``` bash
# npm install -g grunt-cli
2014-07-09 06:35:39 +08:00
$ npm install
```
To watch and auto-build `dist/vue.js` during development:
``` bash
2015-05-11 01:21:57 +08:00
$ npm run dev
2014-07-09 06:35:39 +08:00
```
To lint:
``` bash
2015-07-03 00:22:45 +08:00
$ grunt eslint
2014-07-09 06:35:39 +08:00
```
To build:
``` bash
$ grunt build
```
To test:
``` bash
$ grunt test
```
The default task (by simply running `grunt`) will do the following: lint -> build -> unit tests -> e2e tests. It is required to have this pass successfully for a PR to be considered.
2014-07-09 06:35:39 +08:00
The unit tests are written with Jasmine and run with Karma. The e2e tests are written for and run with CasperJS.
2014-07-09 06:35:39 +08:00
Note that the unit tests will automatically be run in Chrome, Firefox and Safari. If you are not on a Mac, or don't have one of the browsers installed on your system, you can modify the [karma config in gruntfile.js](https://github.com/yyx990803/vue/blob/dev/gruntfile.js#L38) to only run Karma tests in browsers that are available on your system. Just make sure dont check in the gruntfile changes for the commit.