Open source Lessons #1

Abid Uzair
Writers Guild
Published in
2 min readDec 12, 2017

Few days ago I was just trying to beat my head around an issue listed in React repository. I figured out few things and when I was finally ready to make a PR, I see there were some code formatting changes due to my editor, which did not adhere to the code style of official repository. In the contributing guidelines, it was mentioned to run yarn prettier before making a PR. I had done the same but it did not solve my issue. There was an optional command to format code according to prettier, which is yarn prettier-all . I ran this command which made all the formatting changes which were required and my first PR got successfully merged into facebook/react 🎉

Great news! But I didn’t stop there. I was wondering why wasn’t this command included in the official guidelines. The first command didn’t work out for me. So I went ahead and made my second PR the same night, suggesting to include yarn prettier-all as well in the contributing guidelines.

My PR was rejected for obvious reasons 😢. I was suggesting every contributor to run a much slower command which runs through the entire code-base rather than running only on files where you made code changes.

After a series of discussions, Brian Vaughn came into the discussion and said something which blew my mind, which is this:

So this approach feels like addressing a symptom without addressing the underlying cause. If code is slipping through unformatted, I’d rather identify how (eg via Git blame) and prevent it from happening again rather than to suggest everyone runs a slower running command before submitting a PR.

I became satisfied by running yarn prettier-all which solved my issue. I did not look into why yarn prettier didn’t work. I realized that before suggesting any new changes, you must first try to understand why the present thing doesn’t work and what is the reason behind it.

I leave this article open ended for you to think if you’ve followed a similar approach to solving a problem without knowing why so and so thing doesn’t work.

Thanks for reading! I will soon be sharing my story of how I made my first PR to facebook/react so stay tuned.

Thanks for reading Writers Guild — A Smedian publication

Join our Facebook Group. Write for us. Share your many stories on ManyStories.com

If you enjoyed this story, please recommend 👏 and share to help others find it!

--

--

Abid Uzair
Writers Guild

Currently empowering the person closest to me. Long term plan is to bend the universe for good. Kinda like changing the world one person at a time.