Skip to content

Latest commit

 

History

History
59 lines (39 loc) · 1.35 KB

prettier.md

File metadata and controls

59 lines (39 loc) · 1.35 KB

What is Prettier

Prettier is a code formatter that outputs code in a consistent style.
See more details: What is Prettier?

Install

Via NPM

npm install --save-dev --save-exact prettier

Optional: Create an empty config file:

node --eval "fs.writeFileSync('.prettierrc','{}\n')"

Optional: Create a .prettierignore file to define what not to format

node --eval "fs.writeFileSync('.prettierignore','# Ignore artifacts:\nbuild\ncoverage\n')"

Find more details in the Prettier installation documentation.

Via VSCode

Install via VSCode Marketplace

For more details on installation and default config see the Prettier VSCode documentation.

Formatting files

Check all files without writing any changes

npx prettier --check .

Format all files

NOTE: For large files and repos this might take while.

npx prettier --write .

Format specific files

Ex.

 npx prettier --write .github/workflows/lint*