A very commonly use cheat sheet
|
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)
|
|
singleQuote
|
Use single quote or double quote (type: boolean)
|
|
quoteProps
|
Add quotation in object (type: string, values: as-needed/consistent/preserve)
|
|
trailingComma
|
Add coma at the end of each statement, if it is possible (type: string, values: none/es5/all)
|
|
bracketSpacing
|
Add a white space between brackets and key-value in object (type: boolean)
|
|
arrowParens
|
Add parentheses around the arrow functions (type: string, values: avoid/always)
|
|
requirePragma
|
Prretier the specified files (type: boolean)
|
|
endOfLine
|
Determine EOF Special character (type: string, values: lf, crlf, cr, auto)
|
|
What is it?
|
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
|
|
Step one
|
npm i -g prettier
|
|
step two
|
ctrl + p, then ext install esbenp.prettier-vscode |
|
Step three
|
create
.prettierrc file and write your configs |
|
Step four
|
Ctrl + p, then type Format Document |
|
Final step
|
Enable
formatOnSave |
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.