We were given the opportunity to contribute to our first open source project i.e Filer. The main aim of Release 0.1 was to learn how to contribute to an Open source project and getting ourselves familiar with the Git and Github.
What changes we made?
Filer was currently using var everywhere and the purpose of Release 0.1 was to update the code to use let, const, and strict mode where applicable.
Why let and const preferred over var?
Well, according to the new update, it is preferred to use let and const over var due to many reasons which are listed below:-
- Let declares a blocked scope variable which can be reassigned easily
- Const declares a constant variable which can’t be reassigned
- Var declares a global variable hence we can’t declare another variable with the same variable name
You can refer to this doc to get further information on when to use var, let and const. Now let’s go over the strict mode!
I decided to modify FS-watcher.js file changing the var variable to let and const where applicable. Also, I added the strict mode getting rid of the reference error. After you decide which file you want to work with, you need to follow the steps listed below:-
- Create an issue by clicking on the new issue button. Provide a title which includes the file you are modifying and the bug name.
- Fork the Filer repository
- Clone the forked repository through git bash or with any git client (eg- TortoiseGit).
- Create a new branch and use the issue number as your branch name.
- Open the project in VS code and run npm install.
- After installation, run npm test to make sure everything is working.
- Make changes you want and run npm test again.
- Commit your changes to the new branch if it passes all the tests.
- Create a pull request to merge your code in the master branch.
Here is the link to my PR and Issue that I’ve created.
Pull Request: https://github.com/filerjs/filer/pull/712
Reviewed Pull Request: https://github.com/filerjs/filer/pull/706