Skip to content

Commit cb4c40e

Browse files
authored
docs: improve the contributing guidelines (TheAlgorithms#1271)
1 parent b36b458 commit cb4c40e

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed

CONTRIBUTING.md

+40-20
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Before contributing
44

5-
Welcome to [TheAlgorithms/Javascript](https://github.com/TheAlgorithms/Javascript)! Before sending your pull requests,
6-
make sure that you **read the whole guidelines**. If you have any doubt on the contributing guide, please feel free to
7-
[state it clearly in an issue](https://github.com/TheAlgorithms/Javascript/issues/new).
5+
Welcome to [TheAlgorithms/JavaScript](https://github.com/TheAlgorithms/JavaScript)! Before sending your pull requests,
6+
make sure that you **read the whole guidelines**. If you have any doubts about the contributing guide, please feel free to
7+
[state them clearly in an issue](https://github.com/TheAlgorithms/JavaScript/issues/new) or by joining our [Discord community](https://the-algorithms.com/discord).
88

99
## Contributing
1010

@@ -15,11 +15,11 @@ referenced and used by learners from around the globe. Being one of our contribu
1515

1616
- You did your work - plagiarism is not allowed.
1717
- Any plagiarized work will not be merged.
18-
- Your work will be distributed under [GNU License](LICENSE) once your pull request is merged.
18+
- Your work will be distributed under the [GNU GPLv3.0](https://github.com/TheAlgorithms/JavaScript/blob/master/LICENSE) once your pull request is merged.
1919
- Your submitted work must fulfill our styles and standards.
2020

21-
**New implementation** is welcome! For example, new solutions to a problem, different representations of a graph data
22-
structure or algorithm designs with different complexity.
21+
**New implementations** are welcome! For example, new solutions to a problem, different representations of a graph data
22+
structure, or algorithm designs with different complexity.
2323

2424
**Improving comments** and **writing proper tests** are also highly welcome.
2525

@@ -52,18 +52,38 @@ Algorithms should:
5252
Algorithms in this repo should not be how-to examples for existing JavaScript packages. Instead, they should perform
5353
internal calculations or manipulations to convert input values into different output values. Those calculations or
5454
manipulations can use data types, classes, or functions of existing JavaScript packages but each algorithm in this repo
55-
should add unique value.
55+
should add a unique value.
56+
57+
#### Commit guidelines
58+
59+
- Follow [**Conventional Commits**](https://www.conventionalcommits.org/en/v1.0.0/) guidelines at all times.
60+
- Use one of the following prefixes (there might be other miscellaneous prefixes, though).
61+
- fix: A bug fix in an algorithm, workflow, configuration/settings, etc..
62+
- feat: A new feature, such as new algorithms, new workflows, etc..
63+
- docs: Documentation changes or fixes, like improving the contributing guidelines, fixing a typo, etc..
64+
- test: Correct existing tests or add new ones.
65+
- chore: Miscellaneous changes that do not match any of the above.
66+
67+
Examples of best commit messages.
68+
69+
```txt
70+
fix: fixed error in XYZ algorithm
71+
feat: re-work the CI workflow
72+
docs: improve the contributing guidelines
73+
test: add self-tests for XYZ algorithm
74+
chore: update readme badges
75+
```
5676

5777
#### File Naming Convention
5878

59-
- filenames should use the UpperCamelCase (PascalCase) style.
79+
- Filenames should use the UpperCamelCase (PascalCase) style.
6080
- There should be no spaces in filenames.
6181
- **Example:** `UserProfile.js` is allowed but `userprofile.js`,`Userprofile.js`,`user-Profile.js`,`userProfile.js` are
6282
not.
6383

6484
#### Module System
6585

66-
We use the [ES Module](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/) system, which bring an
86+
We use the [ES Module](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/) system, which brings an
6787
official, standardized module system to JavaScript.
6888

6989
It roughly means you will need to use `export` and `import` statements instead of `module.exports` and `require()`.
@@ -83,34 +103,34 @@ and inspect the outcome. Example: [RatInAMaze.test.js](Backtracking/tests/RatInA
83103

84104
Please refrain from using `console` in your implementation AND test code.
85105

86-
First you should install all dependencies using:
106+
First, you should install all dependencies using:
87107

88-
```shell
108+
```bash
89109
npm install
90110
```
91111

92112
You can (and should!) run all tests locally before committing your changes:
93113

94-
```shell
114+
```bash
95115
npm test
96116
```
97117

98-
If you want save some time and just run a specific test:
118+
If you want to save some time and just run a specific test:
99119

100-
```shell
120+
```bash
101121
# This will run any test file where the filename contains "koch" (no need to specify folder path)
102122
npm test -- koch
103123
```
104124

105125
You can also start Jest in "watch" mode:
106126

107-
```shell
127+
```bash
108128
npm test -- --watchAll
109129
```
110130

111131
We also prepared a helper script that runs tests only for changed files:
112132

113-
```shell
133+
```bash
114134
npm run test-changed
115135
```
116136

@@ -121,9 +141,9 @@ This will run all tests and watch source and test files for changes. When a chan
121141
To maximize the readability and correctness of our code, we require that new submissions follow the
122142
[JavaScript Standard Style](https://standardjs.com/).
123143

124-
Before committing, please run
144+
Before committing, please run:
125145

126-
```shell
146+
```bash
127147
npm run style
128148
```
129149

@@ -134,7 +154,7 @@ A few (but not all) of the things to keep in mind:
134154

135155
- Use camelCase with the leading character as lowercase for identifier names (variables and functions).
136156
- Names start with a letter.
137-
- Follow code indentation: Always use 2 spaces for indentation of code blocks.
157+
- Follow code indentation: Always use 2 spaces for code-block indentation.
138158

139159
```js
140160
function sumOfArray(arrayOfNumbers) {
@@ -158,4 +178,4 @@ function sumOfArray(arrayOfNumbers) {
158178
- **Be consistent in the use of these guidelines when submitting.**
159179
- Happy coding!
160180

161-
Writer [@itsvinayak](https://github.com/itsvinayak), May 2020.
181+
Writer [@itsvinayak](https://github.com/itsvinayak) and contributors, May 2020.

0 commit comments

Comments
 (0)