Contributing to Open-Source Walkthrough Part 3

We’re in the final stretch, our PR gets merged in!

Kevin Jin
3 min readApr 28, 2019

Previously in Part 2, I made the fix for the issue. Now I will open a PR:

A good description of the PR is important, so reviewers can easily understand it at a glance

Although josedejong should get a Github notification anyways that I opened a PR, I just follow up and tag him in the original issue, just in case.

… A couple minutes later I actually get an email notification from Travis CI that the build failed.

Travis CI does continuous integration, building and running tests for each commit and/or PR

I open up my build in Travis CI and find exactly which part is failing:

Seems like the lint is failing

I have a good idea of what the problem is. Earlier in Part 2 when I was looking at the package.json file, we saw a “build-and-test” command that seemed to run some lint checks (Linting makes sure the code is pretty and formatted).

I forgot to run any linting when I opened the PR, but it’s not too late to add a fix for the linting now.

Adding (lint) fixes to my PR

I have some experience with linting in the past, and it seems that most linters that check your code also have an option to automatically fix the lint errors.

I looked up standardjs, the linter that mathjs (our project) uses, and well look at that. There is an option to fix linting:

This package.json doesn’t have the command included, but I’ll temporarily add it in for my own use-case:

(There’s probably a better way to do this, but this seems like a quick solution for me at the moment)

Now I run it:

I notice the code I added to gulpfile.js is formatted a bit better, which means the lint fixing worked.

Now I can remove the temporary “lintfix” command I added and commit my changes:

This time, I don’t get any emails regarding Travis CI failing, which means everything ran fine. The build seemed to pass and now I just have to wait for josedejong to review my PR.

A day later: merging the PR and aftermath

I get a Github notification that my PR was merged. Great!

josedejong, who is being a really great maintainer here, actually invites me to participate more actively in the mathjs developer community.

I’ll test the mathjs beta like I told josedeong. I can also continue working on other mathjs tickets now that I’m more familiar with the project. Or I can begin looking for another open source project to work on. There are a number of different routes to go from here. :)

This is the first time I’ve done any kind of guide like this. Let me know if it was helpful or if it wasn’t. Thanks for reading and best of luck on your own open source contributions!

--

--

Kevin Jin

Kevin graduated from Vanderbilt in 2021 and did 9 SWE internships when he was there, including at various top tech companies like Google, Tesla, Flexport, etc.