Mauro Bringolf

Currently geeking out as WordPress developer at WebKinder and student of computer science at ETH.

Hacktoberfest: Four open source pull requests in October

October 26, 2017
, ,

Digital ocean currently runs a month-long celebration of open source called Hacktoberfest1. I love the idea and want to get involved with open source on a regular basis anyway, so I browsed GitHub and found some issues to tackle. Here are my pull requests from this month and what I learned during the process.

babel/babel: Rename variables es3 reserved words 2

This is the biggest one from this list. I learned some things about ECMAscript specifications and added a small new feature to Babel which is really cool. Basically, a programming language defines a set of reserved words which are not allowed as names for functions, variables et cetera. These include language keywords such as function, class or var in JavaScript. However, not only keywords can be reserved but other strings as well. Now it turns out that an older version of JavaScript called ES3 actually reserved more words than necessary which were removed in newer specifications such as ES5 or ES2015. Now when Babel compiles from newer JavaScript versions into ES3 it should check that none of the “old” reserved words are used. Yes, this is almost never a problem but someone requested this feature and a corresponding issue was opened. And I think for a project like Babel, spec compliancy is important in itself regardless of the practical relevance. The required renaming process might sound complicated, but it happens often that Babel has great API’s for it and the code I had to write in the end was really simple. It basically comes down to something like this:

if (!t.isValidES3Identifier( {

If you think that is cool and wonder how on earth this works, you should check out Babel!

kentcdodds/babel-plugin-codegen: Fix babel-macros link 3

Everyone makes typos. If you spot one, fix it! This was just a broken link in the readme file, but I even learned something doing it: You can make reference style links in markdown4 in order to avoid cluttering up text with urls. Neat!

kentcdodds/babel-plugin-preval: Add error message 5

This one I did not find via an issue, but while looking into the code to understand what this project does. I stumbled upon an error handler containing a comment saying that a helpful error message should be thrown at this point. Perfect fit, since I was about to figure out what the code did anyways! The project runs continuous integration and requires code coverage of 100% which means once I added the error message, I also had to write a test for the error to be thrown. Luckily the testing setup was nice enough to make this straightforward.

jgthms/bulma: Source tag for module docs 6

This pull request is basically a sketch implementation of something I would like to see in Bulma’s documentation. The CSS framework’s source is modular SASS and encourages you to only import what you need. However, just from the directory and file names it is not always clear what that is. I would like a source tag to the documentation of each module, showing exactly what source file it corresponds to. Let’s see what happens.