|
| 1 | +# Contributing |
| 2 | + |
| 3 | +:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: |
| 4 | + |
| 5 | +The following is a set of guidelines for contributing to all the repositories managed by [@LJHarb](https://github.com/ljharb), which are hosted on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. |
| 6 | + |
| 7 | +# How Can I Contribute? |
| 8 | + |
| 9 | +There are lots of ways to get involved. Here are some suggestions of things we'd love some help with. |
| 10 | + |
| 11 | +## Resolving existing issues |
| 12 | + |
| 13 | +You can consider helping out with issues already requiring attention - look for a "help wanted" label. |
| 14 | + |
| 15 | +## Reporting issues |
| 16 | + |
| 17 | +If you run into problems in the project, you can report them by opening a new issue within the repository. Before filing an issue, please perform a cursory search to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one. If there is an issue template available, please always fill it out in its entirety - the template is there for a reason. |
| 18 | + |
| 19 | +### How Do I Submit a (Good) Bug Report? |
| 20 | + |
| 21 | +Explain the problem and include additional details to help maintainers reproduce the problem: |
| 22 | + |
| 23 | +* **Use a clear and descriptive title** for the issue to identify the problem. |
| 24 | + |
| 25 | +* **Describe the exact steps which reproduce the problem** in as many details as possible. For example, start by explaining which command exactly you used in the terminal. When listing steps, **don't just say what you did, but explain how you did it**. For example, if you moved the cursor to the end of a line, explain if you used the mouse, or a keyboard shortcut or a command, and if so which one? |
| 26 | +* **Provide specific examples to demonstrate the steps**. Include links to files or Github projects, or copy/pasteable snippets, which you use in those examples. If you're providing snippets in the issue, use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines). |
| 27 | +* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior. |
| 28 | +* **Explain which behavior you expected to see instead and why.** |
| 29 | +* **Provide as much context as possible** in order to help others verify and ultimately fix the issue. |
| 30 | + |
| 31 | +## Documentation |
| 32 | + |
| 33 | +We are happy to welcome contributions from anyone willing to improve documentation by adding missing information or making it more consistent and coherent. |
| 34 | + |
| 35 | +# Dev Environment |
| 36 | + |
| 37 | +* Install [Node.js](https://nodejs.org/en/), preferably with [nvm](https://github.com/nvm-sh/nvm) |
| 38 | + |
| 39 | +* [Fork the repo and clone your fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) |
| 40 | + |
| 41 | +* Get all dependencies |
| 42 | + ``` |
| 43 | + npm install |
| 44 | + ``` |
| 45 | +* Add the upstream source for being able to sync main project changes back into your fork. For example, to configure an upstream remote repository for a fork of https://github.com/ljharb/repo-report run: |
| 46 | + ``` |
| 47 | + git remote add upstream [email protected]:ljharb/repo-report.git |
| 48 | + ``` |
| 49 | +* Run the tests and the build |
| 50 | + ``` |
| 51 | + npm test |
| 52 | + ``` |
| 53 | +* Make and submit changes to the project source files following our [pull request submission workflow](#pull-requests) |
| 54 | + |
| 55 | +# Style Guide / Coding conventions |
| 56 | + |
| 57 | +### Pull requests |
| 58 | + |
| 59 | +Create a new branch |
| 60 | + |
| 61 | +``` |
| 62 | +git checkout -b issue1234 |
| 63 | +``` |
| 64 | + |
| 65 | +Commit the changes to your branch, including a coherent commit message that follows our [standards](#commit-messages) |
| 66 | + |
| 67 | +``` |
| 68 | +git commit -a |
| 69 | +``` |
| 70 | + |
| 71 | +Before sending the pull request, make sure your code is running on the latest available code by rebasing onto the upstream source |
| 72 | + |
| 73 | +``` |
| 74 | +git fetch upstream |
| 75 | +git rebase upstream/main |
| 76 | +``` |
| 77 | + |
| 78 | +Verify your changes. Tests that fail without your changes *must* be added. |
| 79 | + |
| 80 | +``` |
| 81 | +npm test |
| 82 | +# or |
| 83 | +npm run tests-only |
| 84 | +``` |
| 85 | + |
| 86 | +Push your changes |
| 87 | + |
| 88 | +``` |
| 89 | +git push origin issue1234 |
| 90 | +``` |
| 91 | + |
| 92 | +Send the [pull request](https://docs.github.com/en/pull-requests), make requested changes, and get merged. |
| 93 | + |
| 94 | +### Commit Messages |
| 95 | + |
| 96 | +* Limit the first line of the commit message (message summary) to 72 characters or less. |
| 97 | +* Use the present tense ("Add feature" not "Added feature") and imperative mood ("Move cursor to..." not "Moves cursor to...") when providing a description of what you did. |
| 98 | +* If your PR addresses an issue, reference it in the body of the commit message. |
| 99 | +* See the rest of the conventions [here](https://gist.github.com/ljharb/772b0334387a4bee89af24183114b3c7) |
| 100 | + |
| 101 | +#### Commit message example |
| 102 | + |
| 103 | +``` |
| 104 | +[Tag]: Short description of what you did |
| 105 | +
|
| 106 | +Longer description here if necessary |
| 107 | +
|
| 108 | +Fixes #1234 |
| 109 | +``` |
| 110 | + |
| 111 | +> **Note:** Add co-authors to your commit message for commits with multiple authors |
| 112 | +
|
| 113 | +``` |
| 114 | +Co-authored-by: Name Here <email@here> |
| 115 | +``` |
| 116 | + |
| 117 | + |
| 118 | +# Code of Conduct |
| 119 | +[Code of Conduct](https://github.com/ljharb/.github/blob/HEAD/CODE_OF_CONDUCT.md) |
| 120 | + |
| 121 | +# Where can I ask for help? |
| 122 | +If you have any questions, please contact [@LJHarb](mailto:[email protected]). |
0 commit comments