# Basic configuration

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 <mark style="color:purple;">.vscode</mark> and inside it the file <mark style="color:purple;">settings.json</mark> with the following content.

```json
{
  "editor.tabSize": 2,
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode"
}
```

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](https://www.npmjs.com/package/prettier-plugin-organize-imports) allows for exactly that, so let's install it.

```sh
yarn add -D prettier-plugin-organize-imports
```

Now, in the <mark style="color:purple;">.prettierrc file</mark>, we should enable this plugin. We can also set the <mark style="color:blue;">`endOfLine`</mark> option to <mark style="color:blue;">`auto`</mark>, so that no specific line break is enforced (it may follow your OS standard).

```json
"endOfLine": "auto",
"plugins": ["prettier-plugin-organize-imports"]
```

Secondly, in <mark style="color:purple;">tsconfig.json</mark>, disable the option <mark style="color:blue;">`strictNullChecks`</mark>, and in <mark style="color:purple;">esling.config.mjs</mark>, disable the following rules. This is done for more flexibility related to **strictness checks**.

```javascript
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'no-case-declarations': 'off',
```

Thirdly, inside <mark style="color:purple;">tsconfig.json</mark>, you can set the <mark style="color:blue;">`baseUrl`</mark> field to <mark style="color:blue;">`src`</mark>, making this folder our root path. Another interesting setting would be to add the <mark style="color:blue;">`paths`</mark> field just below <mark style="color:blue;">`baseUrl`</mark>, and inside it the following value. This will shorten domain entities' paths.

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

Fourthly, inside the <mark style="color:purple;">src</mark> folder, delete all the <mark style="color:purple;">app.\*</mark> files (except <mark style="color:purple;">app.module</mark>). Then, inside <mark style="color:purple;">app.module</mark>, 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.

Fifthly, in the <mark style="color:purple;">main</mark> file, prefix the <mark style="color:blue;">`bootstrap()`</mark> call with <mark style="color:blue;">void</mark>, to make it explicit that this async function is called while <mark style="color:red;">not</mark> being awaited, and thus remove the <mark style="color:yellow;">warning</mark>.

<mark style="color:green;">**Commit**</mark> - Basic project configuration

{% hint style="info" %}
If you are interested in the **Parallel module - Prisma**, create now a new branch for it.
{% endhint %}
