Conform to the Standards

20 Sep 2018

The ESLint Experience

We have just started using ESLint with IntelliJ Idea in my ICS 314 class, and it can be… difficult. As I am writing out my code, ESLint will keep nagging that a declared variable was not used or reassigned, which makes me want to ignore all of the error messages because the majority are just “temporary” violations that will resolve itself as I finish writing the function. In my opinion, the most frustrating ESLint rule is that trailing spaces are not allowed. I have always ended my lines of code with a space after the semicolon. Even when I am writing in plain English for other classes, I always end my sentences with a space after the period, even if there is a new paragraph or nothing after it. It is going to be difficult to break this habit that has been years in the making, but hopefully I get used to it soon. On the other hand, ESLint can be quite helpful in other ways. When declaring variables, I usually use the keyword “let” because more often than not, their values will end up changing, and I don’t want to put restrictions on something that I might need to change later. However, ESLint will report an error message if a variable is not reassigned. This forces me to think about what these variables are doing and how they are being used, instead of just hastily finishing the exercise with superficial knowledge of the topic or concepts. Another positive aspect about ESLint is that it clearly states a description of the violation along with its official title, making it easy to fix. Even if you do not understand the description, simply looking up the violation’s title will provide sufficient information to fix the problem.

Past Experiences

This isn’t the first time that I’ve been forced, ahem, I mean encouraged, to follow coding standards. In my first two semesters of taking Computer Science classes, I had the same TA, who would take off a point for every coding standard violation. This compelled me to learn and understand the coding standards for our class. I was frustrated and annoyed at first because I was losing points for something that I believed to be trivial. However, without this “motivation,” I would not have gotten into the habit of neatly formatting my code even when my work is not being reviewed by someone else and there are no formal coding standards to follow. Although it may be frustrating now, I believe that conforming to these coding standards will eventually prove to be useful. In a professional environment, it is necessary to follow coding standards, especially when working on a team with other developers. Having everyone follow the same coding standards allows each developer to easily read and work on the code in a quick and efficient manner, instead of having to decipher someone’s specific coding style or format.