How to send pull requests
#
Submitting a Pull Request (PR)The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge. It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you?
Before you submit your Pull Request (PR) consider the following guidelines:
Search GitHub for an open or closed PR that relates to your submission. You don't want to duplicate effort.
Be sure that an issue describes the problem you're fixing, or documents the design for the feature you'd like to add. Discussing the design up front helps to ensure that we're ready to accept your work.
Fork the erxes/erxes repo.
Make your changes in a new git branch:
Note: Please create new branch from develop branch
Create your patch, including appropriate test cases.
Follow our Coding Standards.
Run the full erxes test suite, as described in the developer documentation, and ensure that all tests pass.
Commit your changes using a descriptive commit message that follows our commit message conventions. Adherence to these conventions is necessary because release notes are automatically generated from these messages.
Note: the optional commit -a command line option will automatically "add" and "rm" edited files.
Push your branch to GitHub:
In GitHub, send a pull request to
erxes:develop
.
If we suggest changes then:
- Make the required updates.
- Re-run the erxes test suites to ensure tests are still passing.
- Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
That's it! Thank you for your contribution!
#
After your pull request is mergedAfter your pull request is merged, you can safely delete your branch and pull the changes from the main (upstream) repository:
Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
Check out the develop branch:
Delete the local branch:
Update your develop with the latest upstream version:
#
Coding Standards#
Common rulesTo ensure consistency throughout the source code, keep these rules in mind as you are working:
All features or bug fixes must be tested by one or more specs (unit-tests).
We follow https://github.com/felixge/node-style-guide.
We use https://github.com/prettier/prettier code formatter
File names must be in camel case
#
CommentsUse
/** ... */
for multiline comments. Include a description, specify types and values for all parameters and return values.Use
//
for single line comments. Place single line comments on a newline above the subject of the comment. Put an empty line before the comment.
Prefixing your comments with
FIXME
orTODO
helps other developers quickly understand if you're pointing out a problem that needs to be revisited, or if you're suggesting a solution to the problem that needs to be implemented. These are different than regular comments because they are actionable. The actions areFIXME -- need to figure this out
orTODO -- need to implement
.- Use
// FIXME
: to annotate problems
- Use
// TODO
: to annotate solutions to problems
- Use
#
React- Extension must be
.js
not.jsx
- Put data fetching logics in containers folder
- Put static representations (dumb components) in components folder
- Put graphql queries, mutations and subscriptions in separate file
#
Graphql#
Naming queries- List query (brands, conversations, etc...)
- Detail query (brandDetail, conversationDetail, etc...)
#
Naming mutations{model name camel case}{plural}{action name}
- Create mutation (brandsAdd, channelsAdd, etc...)
- Update mutation (brandsEdit, channelsEdit, etc...)
- Delete mutation (brandsRemove, channelsRemove, etc..)
#
RequirementsMutations must be easily testable. Write utils functions in associated models
Keep mutations and queries files simple. Write utils or helper functions in associated models
Every mutation must have unit tests