Hello amazing folks!๐
Let's discuss something interesting today.
Let's understand what and why about Eslint
and Prettier
.
Imagine working over a project with more than 10 developers
to achieve a vision ๐งโ๐ป. After 3 months you realize how messy things are now ๐ค.
Funny part is even the person who wrote the code is confused in their own code ๐.
Want to avoid such scenario ? ๐ถ
Form a structure which everyone will follow while writing their codes to make it easily understandable by everyone โ. Sounds easy right ? But will everyone follow those things that seriously ๐ค!
Think about someone getting added to the team. The person is a little freedom lover and mostly forgets to follow those set of rules. ๐
Hmm... code getting messed slowly right ?
Ya that's what Eslint
and Prettier
comes into play ๐. Eslint
and Prettier
are used to format the whole codebase into some set of rules.
Like there should not be any console log while pushing any code to production . Mainly done to ensure there is no printing of sensitive data on the logs.
Want to have a peak on how it looks ?
{
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none",
"jsxBracketSameLine": true
}
Here's a peak of the configuration of the Prettier
. You can see there are rules which can be made true based on your need.
Want to read more ๐ https://prettier.io/docs/en/index.html
{
"rules": {
"semi": ["error", "always"],
"quotes": ["error", "double"]
}
}
A small peak of Eslint
, you can set types as warning or error. Forcing developers to follow a proper structure of coding.
I know ! I know !
Many people will think why force some rules while coding to developers. Let them code freely without any rules and restrictions ๐ค.
I also used to believe the same !
But when I was working over a project with other developers, I understood how difficult it becomes when you have to read others messy code ๐โโโ.
I know maybe it's sometimes painful but it's worthed. As clean coding is always tough for developer but when the project becomes large it becomes very easy for new developers and the existing developers to work on it ๐.
I would say. Just try it , I can give you guarantee you will fall love with it ๐.
And at last I want to say ๐
Keep coding #๏ธโฃ , keep rocking ๐
Top comments (2)
These two extensions make programming so much easier for us developers.
Of course Andrew ๐. I used to be one of the developer's who used to love freedom while working over a project. But around 2 months earlier I started working over a amazing startup which gave me the opportunity to brainstorm things.
And guess what ๐ฎ. A freedom loving developer like me understood how much important clean coding means and started to love how this works.
That's how I got the idea of writing this blog. To share the information that how important it is really for developers to have eslint and prettier on their projects ๐.