Thursday, March 16, 2023
HomeReactWelcoming Prettier

Welcoming Prettier

Prettier.js is a fantastic way to systemize and automate your project's code style.

Prettier is “an opinionated code formatter”, constructed to suit your programmer operations. It’s been out on the planet for a long time currently, yet up until today, I had actually never ever efficiently utilized it in any kind of job I serviced. Actually, there’s a couple of factors for this:

  1. I was truly utilized to (as well as truly satisfied with) making use of eslint-config-airbnb for every one of my tasks. Throughout the board, I would certainly set up every node/react/js-based job to utilize the exact same airbnb config, as well as had an useful operations for guaranteeing code high quality at some degree with those dust checks.
  2. I was also active to switch over. This is a little a bullshit response, because among prettier’s greatest promoted attributes is its light-weight arrangement. That’s and also the quantity of time that prettier need to conserve me when being used. A poor reason.
  3. I can never ever obtain it to function(!) So – regardless of being skilled at reviewing docs, each and every single time I began down the course of establishing prettier on a job, I could not obtain it to function. Regardless of my peers screaming from the roofs regarding just how delightfully superb prettier makes the growth operations, it felt like an irreversible deadlock.

So what was the trouble, after that?

Well, everything boiled down to a format problem. The header photo for this write-up informs the tale: every single time I set up prettier, when I set off formatting with Aesthetic Workshop Code’s formatOnSave setup, my React/jsx parts would certainly obtain clambered. After some scrunching up your eyes, it shows up that something was informing my IDE to deal with these jsx submits as pure Javascript, where <


Most Popular

Recent Comments