Basic configuration
We will set some configurations in our project to make its development easier and more standardized.
Let's set some configuration settings to provide better ergonomy to our development process. We will define them in a file related to the project, so that other developers would maintain these patterns.
Firstly, create in the root directory, the folder .vscode and inside it the file settings.json with the following content.
These options are used in order to:
Maintain the same tab size as the Nest CLI when creating files manually (also the prettier default)
Format files automatically on save
Use prettier as the default code formatter
Apart from formatting, it would be great to also organize imports on save. Luckily, this package allows for exactly that, so let's install it.
Now, in the .prettierrc file, we should enable this plugin. We can also set the endOfLine
option to auto
, so that no specific line break is enforced (it may follow your OS standard).
Secondly, in tsconfig.json, disable the option strictNullChecks
, and in esling.config.mjs, disable the following rules. This is done for more flexibility related to strictness checks.
Thirdly, inside tsconfig.json, you can set the baseUrl
field to src
, making this folder our root path. Another interesting setting would be to add the paths
field just below baseUrl
, and inside it the following value. This will shorten domain entities' paths.
Fourthly, inside the src folder, delete all the app.* files (except app.module). Then, inside app.module, remove the references to the deleted files. We do this because these files will never be used at all, so it's just a cleanup.
Commit - Basic project configuration
If you are interested in the Parallel module - Prisma, create now a new branch for it.
Last updated