Itch in a Developer's eyes

   I am a big fan of Prettier. As a developer, I think it makes my life easier. I can switch off a part of my brain which worries about formatting while writing code. I have integrated it with my editor. The moment I press 'save', it formats my code. A beautiful code structure appears in front of my eyes. No worries. The first thing I do, when I set up any JS projects, is set up prettier in my workspace. Just make a '.prettierrc' file and my editor has a plugin to detect it and my work is done. It automatically starts formatting and beautifying my code.
    When I joined my current company, I had convinced my coworkers to move to prettier. They had an ESlint set up which was doing the code formatting during committing with the help of a pre-commit hook. I did not like this for two main reasons. (1) I do not like the ESlint plugin showing me spacing errors in the editor. As a result, my workspace turns red. That's why I had to disable the lint plugin in my workspace. I want my ESlint to show logical errors, experimental feature warnings, bad code writing style warnings, etc (in which ESlint is the best). Also, I don't want to fix spacing, comma, and semi-colon errors manually. I want my editor to fix them for me. (2) I don't want my files to get even slightly changed (even a single space) after I had written and tested my code locally. I even do not want to look at the probable errors at this point. Mostly because I don't want to change my code and test every minute details again.
    But there is a catch in using Prettier. You can not install it in an existing large code base without the permission of all the stakeholders. Because you will be pushing a huge diff with your name into the production and later anyone can put a blame on you (git-blame). No sensible developer would want that.
   Today I was in such a situation. I had to work on a new repository that did not have a prettier integration. Initially, I did not think of this as a big issue. But as I started writing my code, I felt how accustomed I am to writing well-formatted code. Most of us, when we code, we spent most of our time modifying the existing code than actually creating new files. Today was no different. My eyes were not adjusting with the badly formatted code. And every time I pressed 'save', I just wanted the file to be formatted magically. Even a good habit can be a curse sometimes.

Comments

Popular posts from this blog

ଜୀବନ

An eccentric dream

An encounter with the Ghost