Contribution in Ember

Safrin
4 min readOct 26, 2020

Another issue, Another PR, Another contribution and Another blog. You know the rule! This is my 3rd PR towards Hactoberfest. I have been looking for the “perfect” issue since last week. I even started working on two of them, SUI components and a Tic tac toe app, but halfway through I was lost. Either it was difficult than I thought or there was not enough information to guide me. After searching and getting frustrated, one of the ember’s framework’s issue caught my eye at 10am today.

https://github.com/emberjs/ember.js/issues/18060

Though there was not enough details about it on the issue, some people had already contributed on that issue as this issue contained multiple parts which guided me. To be honest, I was scared to contribute such a big framework and was overwhelmed by the amount of files and instructions. Then, I remembered my open source prof’s talk on slack from this week, “Removing code is a super power.” I thought why not have some power 😎

As always I followed the basic steps of contribution: forking, cloning, crating a separate branch, installing all necessities and running it. To run it, I needed to install yarn which also required updating npm to the latest version. While everything was installing, I started working on it. As you can see the main task is removing flags, but removing something from somewhere means you have to be aware and keep track of where else it has been used and needed removing. Now, I have a question for you: What’s your first impression when you see this issue? I guess it was something like this, “Oh! It is just removing some code, just press backspace. You are done!” Actually I would lie if I said I did not think the same. Later, I knew how wrong I was. Removing code is a delicate process.

As you can see, there has been multiple flags to remove and just one was left. I picked the last one.

To find which files used EMBER_GLIMMER_SET_COMPONENT_TEMPLATE_FLAG , I took advantage of grep command.

grep -rl "EMBER_GLIMMER_SET_COMPONENT_TEMPLATE_FLAG" .

Easily, I got the list of files and read each files carefully to see where and how this flag has been used. After I had some understanding of the code, I started removing the initialization of the flag, the export of the flag and the flag from if condition. After each changes, I ran yarn start. I committed the changes to my branch. I ran yarn test from master branch to compare the result to make sure I did not break anything. The test passed 😃Finally, I made my PR.

https://github.com/emberjs/ember.js/pull/19229

I wish it ended right here!! My PR failed their linting test twice😢First time, it was double whitespace in one of the file which I fixed easily. The second time, there were 3 errors and I easily fixed 2 of them, but the last one was confusing. The error and the line were:

Delete ‘.’ from prettier/prettier

As can be seen from the above line, there isn’t any . character that needs to be deleted. When I ran the linter test on my computer, it was producing hundreds of similar errors.

After awhile it was obvious that something was seriously wrong because my change only involved 6 files and yet the linter was reporting errors on almost every file. After a bit of researching online, it seemed this may be caused by line endings. I am using a Windows computer where line endings in text files are always of type CRLF. And the above error in CI test was pointing to the line that I did modify. So, perhaps the linter configurations in this project/repository is not setup to handle Windows style line endings.

I had access to another non-Windows computer. I cloned my branch and ran the linter test again. In there, my linter test matched exactly as the CI test. I wasn’t getting hundreds of errors from so many files. So, that confirmed my findings mentioned above. After opening that file in VS Code, the status bar showed that the file now has LF style line ending. After saving the file, I ran the linter test and it passed successfully this time. I committed the changes to all 3 files as needed and pushed my change again. This time the CI completed successfully.

This repository may need to be updated for better cross platform development experience. I’m surprised that a popular framework like this has this problem and there weren’t any existing issues about it. Lastly, I feel thrilled to successfully contribute on such a big framework and hopefully my PR will get merged.

Update(October 26th, 2020)

My PR got merged 😃

--

--