Did you find yourself stuck in a project simply because the patterns used between your colleagues is different? Probably yes!
Actually, to keep the code patterns and conventions for all companies and development teams is one of the most challenge thing they are facing.
Why does it happens? In simple term, because everyone working on this industry learned to program differently, they had different background, they have their own preferences and habits.
Because that, subjects as clean code, SOLID principles, KISS principles and so on are trends, but is there a way to try to automate or at least keep the code under some patterns defined previously?
In that post I will explain about some tools we can use to help us to keep our code under control and make our life easier when our projects is becoming bigger and more developers is join the project.
For that purpose we can use three tools to keep our code with the same standard. Those tools are EditorConfig, ESLint and Prettier.
EditorConfig is a tool to help development teams work with the same pattern, doesn't matter if they are working with different IDE's as code editor.
Can you imagine if a team is working with different IDE's as VSCode, Atom, Sublime or other one? Probably they are working with different text configuration as well, so in the end of the day, we will get every sort of inconsistency in our code when we are trying to merge our code and also, when we are trying to build it.
EditorConfig can help us by given a set of configurations as the type of indentation, which charset we need to use, the end of line and so on.
If would you like to go deep in EditorConfig check it out at editorconfig.org.
I can say ESlint maybe is one of the most important tool to automate code convention. We can use it for projects using NodeJS, ReactJS, React Native and more.
With ESLint we can keep just one pattern for our team.
You can find out more at eslint.org.
Finally, we have Prettier! That tool is used to customize our code format. It means Prettier will remove all original styling code and ensures that all outputted code conforms to a consistent style.
Prettier enforces a consistent code style across our entire codebase by parsing it away and re-printing the parser with its own rules that take the maximum line length into account, wrapping code when necessary.
If you want to get more information about it, check it out at prettier.io.
In the next post, I will show how to configure EditorConfig for VSCode and start to keep our code under control.
That's it, folks!
Thanks for reading and I hope it's been useful for you. Please do comment your questions and suggestions.