Linting JavaScript code
Linting is the process of running a program that will analyze your code for potential errors. It is very useful in catching errors before running your code, so you can fix them before they cause any issues.
JavaScript is a very flexible language, which means that it is very easy to make mistakes. As you get more used to it, you will make fewer mistakes, but it is always good to have a linter to help you.
In the next chapters, we will use ESLint (https://eslint.org/) to lint our code, but there are other options available, such as JSLint (https://www.jslint.com/) and JSHint (https://jshint.com/).
Configuring a linter is not a trivial task, but it is worth the effort. There are many rules available, and it is not easy to know which ones to use. I highly recommend that you use the standard rules (https://standardjs.com/), which are one of the most popular and used by many open source projects (including Node.js, Express, and MongoDB) and companies. You...