DEV Community

anshul137
anshul137

Posted on

DPS909 Blog :Release 0.3 External Project Contribution

Hey everyone, thanks for reading my Blog post. This post is regarding my contribution to External Project Qurl.gq.

Overview

Qurl.gq is an open-source URL Shortener written in Node.js 🔗

Screenshots


Homepage


Info Page

In Release 0.3 we were asked to keep working on larger projects to add more features or fix bugs.

First External Pull Request

For my contribution in an external project I have chosen Qurl.gq.
The reason I chose this project is because

  • I really liked their idea about shortening the URl link.
  • This project is build using Node.js

My contribution

I want to use my skill which I have learned in my course DPS909 Topics-in-open-source and contribute more into Qurl.gq

So I have decided to include the linter into their project.
I have created the new issue Suggesting them to add the ​ESLint into their current project.It will help them to avoid certain code patterns that often lead to bugs.
And I have Create a simple "one-step" solution for running your linter on the entire project from the command line.
Furhtermore, I have added Pre-commit and Pre-push This is a pretty important step. This will ensure that before any developer commits any code, the changes made by him are validated with ESLint, and the code is properly formatted.

Developers tend to commit mistakes while coding. For example, you might forget to close a bracket or you might end up creating a variable that already exists. But, mistakes like this might end up breaking your app or site. We might push this buggy code to a cloud repository or it might take a considerable amount of time to resolve the issues caused due to such mistakes. If your code is being reviewed, it would consume your reviewer's time to find such sloppy mistakes or they might miss it completely.

  • I have added EsLint-Pre-Commit-Hook
  • The pre-commit hook gets triggered at every time you run git commit before Git asks the developer for a commit message or generates a commit object.

ESLint Git pre-commit hook

I have used this EsLint-Pre-Commit-Hook

To add into your current repo

npm i eslint-pre-commit-hook -D

or

yarn add eslint-pre-commit-hook -D

Link to issue

issue-33

Additional note

I have Fixed all the error which was shown by the ESlint and make it error-free code.
From now on developers need to fix all the ESlint Errors otherwise they will not be able to commit their work on Git.
This will help to make code maintenance easy.

Outcome

npm run lint

Image description

When I commit my code to git using git commit, the pre- commit test is happening before commiting the file to git. If the test fails it will abort the git cmd with error messages.

Image description

Link to Pull request

PR.

Thanks

Top comments (0)