Skip to content

Commit 0302ed6

Browse files
authored
Fixes issue #69, Add pre-commit hooks for linting (#80)
* pre-commit config file * update prettier modified files * Update README | pre-commit install instructions * Update README * update code snippets as code * add eslint for typescript files * add arg --fix on eslint * prettier hook types specified
1 parent c6e9bc7 commit 0302ed6

25 files changed

+521
-464
lines changed

Diff for: .github/ISSUE_TEMPLATE/bug_report.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
4+
title: ""
55
labels: bug
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**Describe the bug -**
@@ -23,10 +22,11 @@ If needed, share logs related to your problem.
2322
If applicable, add screenshots/screen recordings to help explain your problem.
2423

2524
**System Information (please complete the following information):**
26-
- OS: [e.g. iOS]
27-
- Browser [e.g. chrome, safari]
28-
- Version [e.g. 22]
29-
- Device
25+
26+
- OS: [e.g. iOS]
27+
- Browser [e.g. chrome, safari]
28+
- Version [e.g. 22]
29+
- Device
3030

3131
**Additional context -**
3232
Add any other context about the problem here.

Diff for: .github/ISSUE_TEMPLATE/feature_request_template.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ assignees: ""
1010
A clear and concise description of what you want to add.
1111

1212
**Is your feature request related to a problem? Please describe.** :bulb:
13-
A clear and concise description of what the problem is.
13+
A clear and concise description of what the problem is.
1414

1515
**Describe the solution you'd like** :zap:
1616
A clear and concise description of what you want to happen.
@@ -23,7 +23,7 @@ If applicable, add screenshots to help explain your idea.
2323

2424
**Device Information [optional]:**
2525

26-
- OS: [e.g. iOS/Android]
26+
- OS: [e.g. iOS/Android]
2727

2828
**Additional context**
2929
Add any other context about the problem here.

Diff for: .github/pull_request_template.md

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# Related Issue
2-
- closes #issue goes here
2+
3+
- closes #issue goes here
34

45
# Proposed Changes
5-
- change 1
6-
- change 2
6+
7+
- change 1
8+
- change 2
79

810
# Additional Info
9-
- any additional information or context
11+
12+
- any additional information or context
1013

1114
# Checklist
12-
- [ ] Tests
13-
- [ ] Translations
14-
- [ ] Documentation
15+
16+
- [ ] Tests
17+
- [ ] Translations
18+
- [ ] Documentation
1519

1620
# Screenshots
1721

18-
Original | Updated
19-
:---------------------------:|:--------------------------:
20-
** original screenshot ** | ** updated screenshot **
22+
| Original | Updated |
23+
| :-----------------------: | :----------------------: |
24+
| ** original screenshot ** | ** updated screenshot ** |

Diff for: .github/workflows/issue.yml

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
name: Labeling new issue
22
on:
3-
issues:
4-
types: ['opened']
3+
issues:
4+
types: ["opened"]
55
jobs:
6-
build:
7-
runs-on: ubuntu-latest
8-
steps:
9-
- uses: Renato66/auto-label@master
10-
with:
11-
repo-token: ${{ secrets.GITHUB_TOKEN }}
12-
labels-synonyms: '{"GSSOC21":["gssoc","gssoc21","GSSOC21","GSSOC","GSSoC''21","GirlScript Summer of Code"]}'
13-
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: Renato66/auto-label@master
10+
with:
11+
repo-token: ${{ secrets.GITHUB_TOKEN }}
12+
labels-synonyms: '{"GSSOC21":["gssoc","gssoc21","GSSOC21","GSSOC","GSSoC''21","GirlScript Summer of Code"]}'

Diff for: .pre-commit-config.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/mirrors-prettier
3+
rev: "v2.2.1" # Use the sha or tag you want to point at
4+
hooks:
5+
- id: prettier
6+
types: [javascript, ts, jsx, tsx]
7+
- repo: https://github.com/pre-commit/mirrors-eslint
8+
rev: "v7.23.0" # Use the sha / tag you want to point at
9+
hooks:
10+
- id: eslint
11+
files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
12+
types: [file]
13+
args: [--fix]

Diff for: .prettierrc

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"tabWidth": 4,
3-
"useTabs": false,
4-
"trailingComma": "all",
5-
"printWidth": 100
2+
"tabWidth": 4,
3+
"useTabs": false,
4+
"trailingComma": "all",
5+
"printWidth": 100
66
}

Diff for: CODE_OF_CONDUCT.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ diverse, inclusive, and healthy community.
1717
Examples of behavior that contributes to a positive environment for our
1818
community include:
1919

20-
* Demonstrating empathy and kindness toward other people
21-
* Being respectful of differing opinions, viewpoints, and experiences
22-
* Giving and gracefully accepting constructive feedback
23-
* Accepting responsibility and apologizing to those affected by our mistakes,
24-
and learning from the experience
25-
* Focusing on what is best not just for us as individuals, but for the
26-
overall community
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the
26+
overall community
2727

2828
Examples of unacceptable behavior include:
2929

30-
* The use of sexualized language or imagery, and sexual attention or
31-
advances of any kind
32-
* Trolling, insulting or derogatory comments, and personal or political attacks
33-
* Public or private harassment
34-
* Publishing others' private information, such as a physical or email
35-
address, without their explicit permission
36-
* Other conduct which could reasonably be considered inappropriate in a
37-
professional setting
30+
- The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
3838

3939
## Enforcement Responsibilities
4040

@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
106106
4. ### Permanent Ban
107107

108108
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
109+
standards, including sustained inappropriate behavior, harassment of an
110110
individual, or aggression toward or disparagement of classes of individuals.
111111

112112
**Consequence**: A permanent ban from any sort of public interaction within

Diff for: CONTRIBUTING.md

+66-45
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,127 @@
11
# Contribuiton Guidelines
22

3-
- Please **specify your full name** on your GitHub profile for review.
4-
- Each participant will be assigned **2 issues (max)** at a time to work.
5-
- Participants have **7 days** to complete issues.
6-
- Participants have to **comment on issues** they would like to work on, and mentors will assign you.
7-
- Issues will be assigned on a **first-come, first-serve basis.**
8-
- Participants can also open their issues, but it needs to be verified and labelled by a mentor.
9-
- Before opening a new issue, please check if it is already created or not.
10-
- Share your **work sample** and discuss it before sending PR.
11-
- Pull requests will be merged after being reviewed by a mentor/maintainer.
12-
- Create a pull request from **a branch** not from **Main**.
13-
- You will be **scored** based on the level of issues you have solved.
14-
- It might take a day or tow to review your pull request. Please have patience and be nice.
15-
- We all are here to learn. You are allowed to make mistakes. That's how you learn, right!
3+
- Please **specify your full name** on your GitHub profile for review.
4+
- Each participant will be assigned **2 issues (max)** at a time to work.
5+
- Participants have **7 days** to complete issues.
6+
- Participants have to **comment on issues** they would like to work on, and mentors will assign you.
7+
- Issues will be assigned on a **first-come, first-serve basis.**
8+
- Participants can also open their issues, but it needs to be verified and labelled by a mentor.
9+
- Before opening a new issue, please check if it is already created or not.
10+
- Share your **work sample** and discuss it before sending PR.
11+
- Pull requests will be merged after being reviewed by a mentor/maintainer.
12+
- Create a pull request from **a branch** not from **Main**.
13+
- You will be **scored** based on the level of issues you have solved.
14+
- It might take a day or tow to review your pull request. Please have patience and be nice.
15+
- We all are here to learn. You are allowed to make mistakes. That's how you learn, right!
1616

1717
**Pull Requests review criteria:**
18-
- Please mention parent issue no. with "**#**" in the description while sending a pull request.
19-
- Your work must be original, written by you not copied from other resources.
20-
- You must **comment** on your code where necessary.
18+
19+
- Please mention parent issue no. with "**#**" in the description while sending a pull request.
20+
- Your work must be original, written by you not copied from other resources.
21+
- You must **comment** on your code where necessary.
2122

2223
## GIT AND GITHUB
23-
***
24+
25+
---
26+
2427
Before continuing we want to clarify the difference between Git and Github. Git is a version control system(VCS) which is a tool to manage the history of our Source Code. GitHub is a hosting service for Git projects.
2528

2629
We assume you have created an account on Github and installed Git on your System.
2730

2831
Now tell Git your name and E-mail (used on Github) address.
2932

30-
``` $ git config --global user.name "YOUR NAME" ```
31-
```$ git config --global user.email "YOUR EMAIL ADDRESS"```
33+
`$ git config --global user.name "YOUR NAME"`
34+
`$ git config --global user.email "YOUR EMAIL ADDRESS"`
3235
This is an important step to mark your commits to your name and email.
3336

3437
### FORK A PROJECT -
35-
***
38+
39+
---
40+
3641
You can use github explore - https://github.com/explore to find a project that interests you and match your skills. Once you find your cool project to workon, you can make a copy of project to your account. This process is called forking a project to your Github account. On Upper right side of project page on Github, you can see -
3742

3843
<p align="center"> <img src="https://i.imgur.com/P0n6f97.png"> </p>
3944

4045
Click on fork to create a copy of project to your account. This creates a separate copy for you to workon.
4146

42-
### FINDING A FEATURE OR BUG TO WORKON -
43-
***
47+
### FINDING A FEATURE OR BUG TO WORKON -
48+
49+
---
50+
4451
Open Source projects always have something to workon and improves with each new release. You can see the issues section to find something you can solve or report a bug. The project managers always welcome new contributors and can guide you to solve the problem. You can find issues in the right section of project page.
4552

4653
<p align="center"> <img src="https://i.imgur.com/czVjpS7.png"> </p>
4754

4855
### CLONE THE FORKED PROJECT -
49-
***
56+
57+
---
58+
5059
You have forked the project you want to contribute to your github account. To get this project on your development machine we use clone command of git.
5160

52-
```$ git clone https://github.com/<your-account-username>/<your-forked-project>.git```
61+
`$ git clone https://github.com/<your-account-username>/<your-forked-project>.git`
5362
Now you have the project on your local machine.
5463

55-
### ADD A REMOTE (UPSTREAM) TO ORIGINAL PROJECT REPOSITORY
56-
***
64+
### ADD A REMOTE (UPSTREAM) TO ORIGINAL PROJECT REPOSITORY
65+
66+
---
67+
5768
Remote means the remote location of project on Github. By cloning, we have a remote called origin which points to your forked repository. Now we will add a remote to the original repository from where we had forked.
5869

59-
```$ cd <your-forked-project-folder>```
60-
```$ git remote add upstream https://github.com/<author-account-username>/<project>.git```
70+
`$ cd <your-forked-project-folder>`
71+
`$ git remote add upstream https://github.com/<author-account-username>/<project>.git`
6172
You will see the benefits of adding remote later.
6273

6374
### SYNCHRONIZING YOUR FORK -
64-
***
75+
76+
---
77+
6578
Open Source projects have a number of contributors who can push code anytime. So it is necessary to make your forked copy equal with the original repository. The remote added above called Upstream helps in this.
6679

67-
```$ git checkout master```
68-
```$ git fetch upstream```
69-
```$ git merge upstream/master```
70-
```$ git push origin master```
80+
`$ git checkout master`
81+
`$ git fetch upstream`
82+
`$ git merge upstream/master`
83+
`$ git push origin master`
7184
The last command pushes the latest code to your forked repository on Github. The origin is the remote pointing to your forked repository on github.
7285

7386
### CREATE A NEW BRANCH FOR A FEATURE OR BUGFIX -
74-
***
87+
88+
---
89+
7590
Normally, all repositories have a master branch which is considered to remain stable and all new features should be made in a separate branch and after completion merged into master branch. So we should create a new branch for our feature or bugfix and start working on the issue.
7691

77-
```$ git checkout -b <feature-branch>```
92+
`$ git checkout -b <feature-branch>`
7893
This will create a new branch out of master branch. Now start working on the problem and commit your changes.
7994

80-
```$ git add --all```
81-
```$ git commit -m "<commit message>"```
95+
`$ git add --all`
96+
`$ git commit -m "<commit message>"`
8297
The first command adds all the files or you can add specific files by removing -a and adding the file names. The second command gives a message to your changes so you can know in future what changes this commit makes. If you are solving an issue on original repository, you should add the issue number like #35 to your commit message. This will show the reference to commits in the issue.
8398

8499
### REBASE YOUR FEATURE BRANCH WITH UPSTREAM-
85-
***
100+
101+
---
102+
86103
It can happen that your feature takes time to complete and other contributors are constantly pushing code. After completing the feature your feature branch should be rebase on latest changes to upstream master branch.
87104

88-
```$ git checkout <feature-branch>```
89-
```$ git pull --rebase upstream master```
105+
`$ git checkout <feature-branch>`
106+
`$ git pull --rebase upstream master`
90107
Now you get the latest commits from other contributors and check that your commits are compatible with the new commits. If there are any conflicts solve them.
91108

92109
### SQUASHING YOUR COMMITS-
93-
***
110+
111+
---
112+
94113
You have completed the feature, but you have made a number of commits which make less sense. You should squash your commits to make good commits.
95114

96-
```$ git rebase -i HEAD~5```
115+
`$ git rebase -i HEAD~5`
97116
This will open an editor which will allow you to squash the commits.
98117

99118
### PUSH CODE AND CREATE A PULL REQUEST -
100-
***
119+
120+
---
121+
101122
Till this point you have a new branch with the feature or bugfix you want in the project you had forked. Now push your new branch to your remote fork on github.
102123

103-
```$ git push origin <feature-branch>```
124+
`$ git push origin <feature-branch>`
104125
Now you are ready to help the project by opening a pull request means you now tell the project managers to add the feature or bugfix to original repository. You can open a pull request by clicking on green icon -
105126

106127
<p align="center"> <img src="https://i.imgur.com/aGaqAD5.png"> </p>
@@ -109,4 +130,4 @@ Remember your upstream base branch should be master and source should be your fe
109130

110131
Awesome! You have made your first contribution. If you have any doubts please let me know in the comments.
111132

112-
#### BE OPEN!
133+
#### BE OPEN!

0 commit comments

Comments
 (0)