
Coding standards, love them or hate them, they are a must! Coding standards are a set of rules, guidelines, and best practices that developers use when writing code. While it can be very annoying and tedious to abide by coding standards, it is important to do so. These sets of rules ensure consistency, readability, and reliability. All of which are crucial to having a well-developed product. Coding standards are very much like grammar and punctuation rules in writing. As you can imagine, without those two things, it would be difficult to understand what someone has written. There are also different style guides and rule sets. For example, in JavaScript, there is the popular Airbnb JavaScript Style Guide, and in Python, there is the PEP 8 Style Guide. These guides are akin to the conventions followed when writing an essay using MLA or APA styles.
An extremely helpful tool to keep us in check is ESLint. ESLint is a static code analysis tool, meaning it checks the code before execution. This tool helps us catch errors as we write code, while also enforcing consistency and promoting best practices. ESLint works by parsing the code into an abstract syntax tree and then applying rules that are customizable. It reports issues with line numbers for the location of the problem along with an explanation, providing insight into how you might fix it. A great feature of ESLint is the “eslint-fix” command, which can often automatically correct many issues, saving you time and effort.
My experience with ESLint so far has been overall okay. It is taking some getting used to, although I haven’t worked with it too much yet. In my short time with ESLint, it has caused me many problems—most of which are probably my own doing. For some reason, it was giving me errors and not letting me fix them, such as using double quotes instead of single quotes, and automatically reverting back to double quotes when I tried to save. I did get that fixed, but I had other issues of the same nature that I had to work around or fix. Long term, as I get more comfortable and content with this tool, I see it being less annoying and actually helpful. I’m looking forward to that.