Skip to content

Prettier

Vojtech Mašek edited this page Jan 30, 2020 · 5 revisions

1.

To add prettier install this Angular schematic locally without adding it to the dependencies (package.json)

npm install @schuchard/prettier

2.

Then run in an Angular CLI project's root directory:

ng g @schuchard/prettier:add

It will ask you some questions and you can hit enter (choose the default) every time, the config will be changed to our custom instead of the default.

3.

Add our custom config

4.

Don't forget to add all generated files/folders to .prettierignore file

5.

In package.json scripts you need to enable linting SCSS instead of CSS.

Your script should look like this "prettier --write \"**/*.{js,ts,json,yaml,css,scss,md,component.html,html}\""

If you are using Stylelint do not forget have the latest version of config

Clone this wiki locally