First pull request for Hacktoberfest

Tony He
3 min readOct 8, 2019

I have finally completed the first open source pull request for a real world project. I will talk about the issue I fixed as well as the processes I went through.

Issue worked on

The issue link is as below:

The project is called wunderbot, which is a Javascript based web service for people using Discord bot. The issue is to replace variables declaration using var to use let instead, which will conform to the convention for other part of the code and to related development as well.

Research about var vs. let

Before working on this issue, I was not sure about the difference between var and let. The maintainer provided a link which has the explanation of the difference. In general, var is used for variables with function scope whereas let defined variables are only accessible within the block declared.

How I fixed the code

The pull request link is as below:

After taking look at the code, only two files are related with this issue. In the file price.js, there are many variables declared using var. However, after further examination, all of them can be replaced by let as they are all used within the code block they are defined. Another file purge.js has a piece of code like below:

It is obvious that the declaration of amount and adding can be done using let. For the variable newamount, it has to be declared outside the if/else block in order to be accessed in the block, so I changed the code to:

After the commit, there is no variable declared using var so it conform to the code convention with other files.

Interesting interactions

The issue I worked on was not on Github originally. I found an issue with the same project on a related project called tipbot maintained by the same group of people. After browsing the code, I found that although the issue requested to clean up the var declarations, the code has already been cleaned without a single var. I dropped a comment to the maintainer to bring that up and asked if I understood the issue correctly. Later, the maintainer realized it was not a proper issue so he transferred this issue to the relevant project I worked on.

From this experience, I think that communication is really crucial in the open source community. If I had not dropped the comment, I would not be able to get this issue to work on. It does not cost anything to ask questions or seek to clear your doubts. The opportunities sometime only come up if you take actions.

--

--