My Thoughts on Coding Style Dos and Don'ts

06 Feb 2019

In the past week I was introduced to something called ESLint through my ICS 314: Software Engineering class by my professor. According to the site’s homepage, ESLint is:

"...an open source project originally created by Nicholas C. Zakas in June 2013. Its goal is to provide a pluggable linting utility for JavaScript." -ESLint Homepage

Throughout this past week I’ve been using ESLint in conjunction with IntelliJ Idea in order to make sure my code is formatted according to specific coding standards.

First Thoughts and Opinions on ESLint

This isn’t my first time having to adhere to coding standards. In a previous class where I was learning about C programming, the professor had a coding standard that he wanted all of the students to follow. It is partially due to taking that class last semester that I struggle a bit with ESLint. Since I’m used to typing my code using the standard I had to follow in the C programming class I often need to go back and fix my code because it doesn’t match up with the ESLint coding standards.

In addition to my slight difficulty in transitioning to following this new coding standard I also am slightly confused with some of the rules for the coding standards from ESLint. I don’t quite understand yet when I need ‘block spacing’ which leads to me adding and deleting spaces in order to try and fix red marks in my code.

Those Darn Green Checks

I’m going to be honest, so far I have never gotten a green check once I finish writing my code. And by ‘green check’ I mean a literal tiny green check mark in the upper right hand corner of IntelliJ Idea which signifies that my code fits the coding standards. My most common mistake so far involves something that I mentioned previously, ‘block spacing’. Spaces in general are usually the mistakes in the way of green checks in my case.

It’s not too much of a hassle to just follow the instructions (helpfully provided when I hover over the mistake) but in a timed situation like the Workout of the Day’s given in class it does stress me out a little. However, I’ve only being using ESLint for about a week so far so it’s likely that I’ll become more accustomed with the rules with additional practice.

At the very least, I know that ESLint will help my code look neat and easy to read. In addition, in the future I think it is likely that different companies will have separate coding styles that I will have to learn and use properly. Due to that I believe that is an important educational experience. I will also continue to practice with ESLint and familiarizing myself with its rules to ensure my code fits the respective coding standards.