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.

{
  "files.eol": "\n",
  "editor.tabSize": 2,
  "editor.formatOnSave": true
}

These options are used in order to maintain the same pattern as the Nest CLI when creating files manually (LF line break and two space indentation), and to format files automatically on save. 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.

yarn add -D prettier-plugin-organize-imports

Secondly, as an optional step, I prefer to remove the .js extension from the .eslintrc file to make it a JSON file (due to cosmiconfig). If you do so too, you can also remove the ignorePatterns and tsconfigRootDir fields inside it.

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.

"*": ["domain/*", "*"]

Fourthly and finally, 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