Show Menu
Cheatography

A very commonly use cheat sheet

configs

tabWidth
White spaces number instead of each indent (type: number)
useTabs
Determine indention unit, tab or white space (type: boolean)
semi
Add semi colon at the end of each statement (type: boolean)
single­Quote
Use single quote or double quote (type: boolean)
quoteProps
Add quotation in object (type: string, values: as-nee­ded­/co­nsi­ste­nt/­pre­serve)
traili­ngComma
Add coma at the end of each statement, if it is possible (type: string, values: none/e­s5/all)
bracke­tSp­acing
Add a white space between brackets and key-value in object (type: boolean)
arrowP­arens
Add parent­heses around the arrow functions (type: string, values: avoid/­always)
requir­ePragma
Prretier the specified files (type: boolean)
endOfLine
Determine EOF Special character (type: string, values: lf, crlf, cr, auto)
 

Defenition

What is it?
Prettier is an opinio­nated code formatter. It enforces a consistent style by parsing your code and re-pri­nting it with its own rules that take the maximum line length into account, wrapping code when necessary.
 

How to use?

Step one
npm i -g prettier
step two
ctrl + p
, then
ext install esbenp.pr­ett­ier­-vscode
Step three
create
.prett­ierrc
file and write your configs
Step four
Ctrl + p
, then type Format Document
Final step
Enable
format­OnSave
               
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          SailsJS Cheat Sheet
          Express.js Cheat Sheet
          JavaScript: Basic, Advanced, & More Cheat Sheet