The use of prettier

1. Vscode needs to install the prettier plug-in

2. After the vscode plug-in is installed, you need to set Format on save, which will be automatically formatted when saving.
insert image description here
3. The project should also install the prettier plug-in
npm i --save-dev prettier

.prettierrc.json4. Create a new file in the project root directory

5. Read the article on prettier configuration , which records various configurations in detail, paste them for use, and modify them according to project needs

6. If the code is not formatted into the style defined by prettier when saving, right click - use... to format the document - select prettier code formater
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/bbt953/article/details/130869111