You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+40-20
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
3
3
## Before contributing
4
4
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).
8
8
9
9
## Contributing
10
10
@@ -15,11 +15,11 @@ referenced and used by learners from around the globe. Being one of our contribu
15
15
16
16
- You did your work - plagiarism is not allowed.
17
17
- 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.
19
19
- Your submitted work must fulfill our styles and standards.
20
20
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.
23
23
24
24
**Improving comments** and **writing proper tests** are also highly welcome.
25
25
@@ -52,18 +52,38 @@ Algorithms should:
52
52
Algorithms in this repo should not be how-to examples for existing JavaScript packages. Instead, they should perform
53
53
internal calculations or manipulations to convert input values into different output values. Those calculations or
54
54
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
+
```
56
76
57
77
#### File Naming Convention
58
78
59
-
-filenames should use the UpperCamelCase (PascalCase) style.
79
+
-Filenames should use the UpperCamelCase (PascalCase) style.
60
80
- There should be no spaces in filenames.
61
81
-**Example:**`UserProfile.js` is allowed but `userprofile.js`,`Userprofile.js`,`user-Profile.js`,`userProfile.js` are
62
82
not.
63
83
64
84
#### Module System
65
85
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
67
87
official, standardized module system to JavaScript.
68
88
69
89
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
83
103
84
104
Please refrain from using `console` in your implementation AND test code.
85
105
86
-
First you should install all dependencies using:
106
+
First, you should install all dependencies using:
87
107
88
-
```shell
108
+
```bash
89
109
npm install
90
110
```
91
111
92
112
You can (and should!) run all tests locally before committing your changes:
93
113
94
-
```shell
114
+
```bash
95
115
npm test
96
116
```
97
117
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:
99
119
100
-
```shell
120
+
```bash
101
121
# This will run any test file where the filename contains "koch" (no need to specify folder path)
102
122
npm test -- koch
103
123
```
104
124
105
125
You can also start Jest in "watch" mode:
106
126
107
-
```shell
127
+
```bash
108
128
npm test -- --watchAll
109
129
```
110
130
111
131
We also prepared a helper script that runs tests only for changed files:
112
132
113
-
```shell
133
+
```bash
114
134
npm run test-changed
115
135
```
116
136
@@ -121,9 +141,9 @@ This will run all tests and watch source and test files for changes. When a chan
121
141
To maximize the readability and correctness of our code, we require that new submissions follow the
122
142
[JavaScript Standard Style](https://standardjs.com/).
123
143
124
-
Before committing, please run
144
+
Before committing, please run:
125
145
126
-
```shell
146
+
```bash
127
147
npm run style
128
148
```
129
149
@@ -134,7 +154,7 @@ A few (but not all) of the things to keep in mind:
134
154
135
155
- Use camelCase with the leading character as lowercase for identifier names (variables and functions).
136
156
- 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.
138
158
139
159
```js
140
160
functionsumOfArray(arrayOfNumbers) {
@@ -158,4 +178,4 @@ function sumOfArray(arrayOfNumbers) {
158
178
-**Be consistent in the use of these guidelines when submitting.**
159
179
- Happy coding!
160
180
161
-
Writer [@itsvinayak](https://github.com/itsvinayak), May 2020.
181
+
Writer [@itsvinayak](https://github.com/itsvinayak) and contributors, May 2020.
0 commit comments