To seasoned observers, I just updated the parameters of a regular expression, and added a few tests. Nothing ground breaking. And yet a few years ago, this would have seemed impossible.
Upon discovering a discrepancy between LiquidJS and the original Ruby implementation (the
strip_html filter wasn’t removing HTML tags containing attributes), I knew where to look and what to look for. I knew how to fork the repository, and how to clone it to my computer. I instinctively knew that the first thing I should do is type
npm install in my terminal. I broadly understood how the two regular expressions differed, and with the help of regex101, was able to test my change before committing it to code. I knew how Mocha tests worked, and what I should add in order to maintain test coverage. A small change maybe, but one built upon years of frustration, trial and error, and a begrudging understanding of this most foreign of languages.
This project lingers in the memory for how badly it affected my mood. I felt like complete shit; out of my depth and unable to do my job. Fast forward to last month and a different project, and needing to build a drop-down menu so that users could change their language preference. Rather than be filled with dread, I was excited by the prospect, and was able to build something reasonably robust and accessible in just a few hours. So, what’s changed?
Another tool I have found immensely helpful is ESLint. This parses your code and reports any errors it encounters. I tend to include this in my projects via XO, and with Atom setup to highlight any errors and warnings it generates (each linking to a description on the ESLint website), I can catch any errors before saving a file, avoiding countless hours of head-scratching due to a misplaced typo or malformed function.