![]() All of this fulfills a need in having a consistent, front-end project. These two tools will make sure that the team(s) will have better unity and any PRs will have have minimal changes. Prettier will then ensure that every file will have the same "look and feel" across the project. This is where ESLint and Prettier come into play.ĮSLint will ensure each developer is adhering to certain coding requirements that a team agrees on. This makes reviewing PRs a bit more overwhelming than needed and takes time away from really constructively critiquing the actual needed change. Though what happens when we now have a team? Maybe multiple teams of developers all working together and each developer having their own coding rules and styling? This can quickly complicate our projects as each pull request (PRs) can have a lot more "un-needed" styling changes and code rules that will then be debated. This is because individual developers working on a project can adhere to their own coding rules and styles. Why would we ever need tools like ESLint and Prettier? As an individual developer, these tools would be in the "nice to haves" categories and are not "100%" necessary. Now that we have a clearer definition, ESLint will be used as a linter while Prettier will be taking care of our formatting. An example would be ensuring that all lines of code are 100 in length and then auto-formatting the code to adhere to this rule. Some examples would include ensuring all console.logs() and un-used variables are deleted while more specific rules would be like not allowing the use of continue statements.įormatting: We only care about how the code visually looks, does not involve catching errors or coding rules. ![]() Linting: Is the way to enforce our code to adhere to certain coding practices. ESLint will lint our code while Prettier will simply format our code. ![]() This is because the jobs between these two tools are meant to accomplish different tasks. If you have any questions or would like to learn more on what is happening above, visit my previous article here.Īs a developer, it is always good practice to ask ourselves, why do I need to do this? What use cases would I need to implement this? Is the implementation worth the work compared to the alternative? These are the questions that we are going to be answering.įirst things first, "ESlint vs Prettier" should really always be said: ESLint and Prettier. Now that we have all of the above set-up, the quick set-up should be able to run. Enter fullscreen mode Exit fullscreen mode
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |