-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(contributing): update contributing guidelines (#6)
- Loading branch information
Showing
3 changed files
with
72 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,145 +1,117 @@ | ||
# Contributing | ||
# Contributing to amex-jest-preset-react | ||
|
||
The following guidelines must be followed by all contributors to this repository. Please review them carefully and do not hesitate to ask for help. | ||
✨ Thank you for taking the time to contribute to this project ✨ | ||
|
||
### Code of Conduct | ||
## 📖 Table of Contents | ||
|
||
* Review and test your code before submitting a pull request. | ||
* Be kind and professional. Avoid assumptions; oversights happen. | ||
* Be clear and concise when documenting code; focus on value. | ||
* Don't commit commented code to the main repo (stash locally, if needed). | ||
* [Code of Conduct](#code-of-conduct) | ||
* [Developing](#developing) | ||
* [Submitting a new feature](#submitting-a-new-feature) | ||
* [Reporting bugs](#reporting-bugs) | ||
* [Contributing](#getting-in-contact) | ||
* [Coding conventions](#coding-conventions) | ||
|
||
### Git Commit Guidelines | ||
|
||
We follow precise rules for git commit message formatting. These rules make it easier to review commit logs and improve contextual understanding of code changes. This also allows us to auto-generate the CHANGELOG from commit messages. | ||
## Code of Conduct | ||
|
||
Each commit message consists of a **header**, **body** and **footer**. | ||
This project adheres to the American Express [Code of Conduct](./CODE_OF_CONDUCT.md). By contributing, you are expected to honor these guidelines. | ||
|
||
#### Header | ||
## Developing | ||
|
||
The header is required and must not exceed 70 characters to ensure it is well-formatted in common git tools. It has a special format that includes a *type*, *scope* and *subject*: | ||
### Installation | ||
|
||
Syntax: | ||
1. Fork the repository `amex-jest-preset-react` to your GitHub account. | ||
2. Afterwards run the following commands in your terminal | ||
|
||
```bash | ||
<type>(<scope>): <subject> | ||
``` | ||
```bash | ||
$ git clone https://github.com/<your-github-username>/amex-jest-preset-react | ||
$ cd amex-jest-preset-react | ||
``` | ||
|
||
#### Type | ||
> replace `your-github-username` with your github username | ||
|
||
The *type* should always be lowercase as shown below. | ||
3. Install the dependencies by running | ||
|
||
##### Allowed `<type>` values: | ||
```bash | ||
$ npm install | ||
``` | ||
|
||
* **feat** (new feature for the user) | ||
* **fix** (bug fix for the user, not a fix to build scripts) | ||
* **docs** (changes to documentation) | ||
* **style** (formatting, missing semi colons, etc; no functional code change) | ||
* **refactor** (refactoring production code, eg. renaming a variable) | ||
* **test** (adding missing tests, refactoring tests; no production code change) | ||
* **chore** (updating build/env/packages, etc; no production code change) | ||
4. You can now run any of these scripts from the root folder. | ||
|
||
#### Scope | ||
|
||
The *scope* describes the affected code. The descriptor may be a route, component, feature, utility, etc. It should be one word or camelCased, if needed: | ||
#### Running tests | ||
|
||
```bash | ||
feat(transactions): added column for quantity | ||
feat(BalanceModule): initial setup | ||
``` | ||
- **`npm test`** | ||
|
||
The commit headers above work well if the commit affects many parts of a larger feature. If changes are more specific, it may be too broad. To better clarify specific scopes, you should use a `feature/scope` syntax: | ||
Runs unit tests. | ||
|
||
```bash | ||
fix(transaction/details): missing quantity field | ||
``` | ||
- **`npm run test:git-history`** | ||
|
||
The above syntax helps reduce verbosity in the _subject_. In comparison, consider the following example: | ||
Verifies the format of all commit messages on the current branch. | ||
|
||
```bash | ||
fix(transaction): missing quantity field in txn details | ||
``` | ||
- **`npm posttest`** | ||
|
||
Another scenario for scope is using a `route/scope` (or `context/scope`) syntax. This would be useful when a commit only affects a particular instance of code that is used in multiple places. | ||
Verifies the format of all commit messages on the current branch. | ||
|
||
*Example*: Transactions may be shown in multiple routes/contexts, but a bug affecting transaction actions may only exist under the "home" route, possibly related to other code. In such cases, you could use the following format: | ||
## Submitting a new feature | ||
|
||
```bash | ||
fix(home/transactions): txn actions not working | ||
``` | ||
When submitting a new feature request or enhancement of an existing features please review the following: | ||
|
||
This header makes it clear that the fix is limited in scope to transactions within the home route/context. | ||
### Is your feature request related to a problem | ||
|
||
#### Subject | ||
Please provide a clear and concise description of what you want and what your use case is. | ||
|
||
Short summary of the commit. Avoid redundancy and simplify wording in ways that do not compromise understanding. | ||
### Provide an example | ||
|
||
Good: | ||
Please include a snippets of the code of the new feature. | ||
|
||
```bash | ||
$ git commit -m "fix(nav/link): incorrect URL for Travel" | ||
``` | ||
### Describe the suggested enhancement | ||
|
||
Bad: | ||
A clear and concise description of the enhancement to be added include a step-by-step guide if applicable. | ||
Add any other context or screenshots or animated GIFs about the feature request | ||
|
||
```bash | ||
$ git commit -m "fix(nav): incorrect URL for Travel nav item :P" | ||
``` | ||
### Describe alternatives you've considered | ||
|
||
> Note that the _Bad_ example results in a longer commit header. This is partly attributed to the scope not being more specific and personal expression tacked on the end. | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
**Note regarding subjects for bug fixes:** | ||
## Reporting bugs | ||
Summarize _what is fixed_, rather than stating that it _is_ fixed. The _type_ ("fix") already specifies the state of the issue. | ||
All issues are submitted within GitHub issues. Please check this before submitting a new issue. | ||
For example, don't do: | ||
### Describe the bug | ||
```bash | ||
$ git commit -m "fix(nav): corrected Travel URL" | ||
``` | ||
A clear and concise description of what the bug is. | ||
Instead, do: | ||
### Provide step-by-step guide on how to reproduce the bug | ||
```bash | ||
$ git commit -m "fix(nav): broken URL for Travel" | ||
``` | ||
Steps to reproduce the behavior, please provide code snippets or a link to repository | ||
### Expected behavior | ||
#### Body and Footer (optional) | ||
Please provide a description of the expected behavior | ||
The body and footer should wrap at 80 characters. | ||
### Screenshots | ||
The **body** describes the commit in more detail and should not be more than 1 paragraph (3-5 sentences). Details are important, but too much verbosity can inhibit understanding and productivity -- keep it clear and concise. | ||
If applicable, add screenshots or animated GIFs to help explain your problem. | ||
The **footer** should only reference Pull Requests or Issues associated with the commit. | ||
### System information | ||
For bug fixes that address open issues, the footer should be formatted like so: | ||
Provide the system information which is not limited to the below: | ||
```bash | ||
Closes #17, #26 | ||
``` | ||
and for Pull Requests, use the format: | ||
- OS: [e.g. macOS, Windows] | ||
- Browser (if applies) [e.g. chrome, safari] | ||
- Version of amex-jest-preset-react: [e.g. 5.0.0] | ||
- Node version:[e.g 10.15.1] | ||
```bash | ||
Related #37 | ||
``` | ||
### Security Bugs | ||
If a commit is associated with issues and pull requests, use the following format: | ||
Please review our [Security Policy](./SECURITY.md). Please follow the instructions outlined in the policy. | ||
```bash | ||
Closes #17, #26 | ||
Related #37 | ||
``` | ||
> Issues should always be referenced before pull requests, as shown above. | ||
## Getting in contact | ||
#### Piecing It All Together | ||
- Join our [Slack channel](https://one-amex.slack.com) request an invite [here](https://join.slack.com/t/one-amex/shared_invite/enQtOTA0MzEzODExODEwLTlmYzI1Y2U2ZDEwNWJjOTAxYTlmZTYzMjUyNzQyZTdmMWIwZGJmZDM2MDZmYzVjMDk5OWU4OGIwNjJjZWRhMjY) | ||
Below is an example of a full commit message that includes a header, body and footer: | ||
## Coding conventions | ||
```bash | ||
refactor(nav/item): added prop (isActive) | ||
|
||
NavItem now supports an "isActive" property. This property is used to control the styling of active navigation links. | ||
### Git Commit Guidelines | ||
Closes #21 | ||
``` | ||
We follow [conventional commits](https://www.conventionalcommits.org/) for git commit message formatting. These rules make it easier to review commit logs and improve contextual understanding of code changes. This also allows us to auto-generate the CHANGELOG from commit messages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters