Dear PC readers:
Welcome back to my blog!
This week we had to work on Lab 7 and one PR for Release 0.3. So as this blog's name depicts, I am going to tell you people about the Lab 7. In this week's lab, we had to take our project, guess which one? Oh my god, how did you know? Yess.. you guessed it right. The one and only, URL inspector.
New Branch
So the first task was to create a new branch and do all the work needed in this branch only. I created the branch lab7 and started working on it.
Create Contributing.md
The next step was to take all of the installation and usage steps or guide from Readme.md to a new file called contributing.md. So I did that and moved ahead to the next step.
Prettier
Since I worked on Javascript so I used Prettier for my source code formatter. It was pretty easy to use. I used this command to install it. And used this command to create an empty config file to let other users know(in case) that I am using prettier as mentioned on https://prettier.io/docs/en/install.html I then went ahead and created a ignore file for prettier to give the ignore the given files.
The command to use prettier was
to check and format everything altogether for all files. To check only, you can use
To check a particular file, you can remove "." and add the file name there.
The code changed in various ways like indentation for the brackets, using double quotes instead of single quotes etc. And I
realized I already had the prettier with my VSCode. But still I had
changes after running it.
ESLINT
The next step was to add a linter for the source code. With JS, I used ESlinter. This one was pretty easy too.
npm install eslint --save-devnpx eslint --init And to run it, just use :
npx eslint yourfile.jsI did this with all of my Js files, not many errors came. Just 2 that the invalid and res were not defined in fileHandler and index file respectively. I fixed those and Voila!!
IDE Integration
I already had these two in my IDE VSCode. I added the information in the contributing.md also. They can be easily found in the extensions as below:
and
At last, I squashed all of the commits in one and merged them to master and pushed to the origin.
And that is all, my friends. Take care!
See you in next blog!
Best,
PC
No comments:
Post a Comment