You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/first-steps.md
+46Lines changed: 46 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,3 +112,49 @@ $ npm run start:dev
112
112
```
113
113
114
114
This command will watch your files, automatically recompiling and reloading the server.
115
+
116
+
#### Linting / formatting
117
+
118
+
[Nest CLI](/cli/overview) provides best effort to scaffold a reliable development workflow at scale. Thus, a generated Nest project comes with both a code **formatter** and **linter** preinstalled (respectively [eslint](https://eslint.org/) and [prettier](https://prettier.io/)).
119
+
120
+
> info **Hint** Not sure about the role of formatters VS linters ? Learn the difference [here](https://prettier.io/docs/en/comparison.html).
121
+
122
+
##### VSCode usage
123
+
To ensure maximum stability and extensibility, we use official [`eslint`](https://www.npmjs.com/package/eslint) and [`prettier`](https://www.npmjs.com/package/prettier) cli packages. This setup allows neat IDE integration with official tooling.
124
+
125
+
For example with *VSCode*, a Nest project is compatible with [`vscode-eslint`](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [`prettier-vscode`](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) by design !
126
+
127
+
> warning **Warning** You might be tempted to try [~~`vs-code-prettier-eslint`~~](https://marketplace.visualstudio.com/items?itemName=rvest.vs-code-prettier-eslint). This extension is meant to play with [~~`prettier-eslint`~~](https://github.com/prettier/prettier-eslint) package witch is **not** used inside a Nest project by default.
128
+
129
+
##### Scripted usage
130
+
For headless environments where an IDE is not relevant (*Continuous Integration*, *Git hooks*, ...), a Nest project comes with ready-to-use `npm` (or `yarn`) scripts.
131
+
132
+
```bash
133
+
# Lint and autofix with eslint
134
+
npm run lint
135
+
# Format with prettier
136
+
npm run format
137
+
138
+
# OR
139
+
140
+
# Lint and autofix with eslint
141
+
yarn lint
142
+
# Format with prettier
143
+
yarn format
144
+
```
145
+
146
+
##### Plugins and config
147
+
148
+
A Nest cli scaffolded project uses
149
+
-[`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier) to remove conflicting rules from `eslint` for use with `prettier`.
150
+
-[`@typescript-eslint/plugin`](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin) to enable Typescript linting
151
+
152
+
> info **Hint** You can learn more about the behavior of `eslint-plugin-prettier` in its [documentation](https://github.com/prettier/eslint-plugin-prettier#recommended-configuration) and discover the actual configuration inside generated [`.eslintrc.js`](https://github.com/nestjs/typescript-starter/blob/master/.eslintrc.js) file
153
+
154
+
##### Code style
155
+
156
+
With this stack setup, by default we ensure the resulting code follows :
0 commit comments