mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-04-22 09:56:35 +00:00
Closest flag to this is the --ignore-path option in the Prettier docs, but it's different (path to a list of ignored directories). Doesn't seem necessary to include here as it already looks for the ./.prettierignore file
45 lines
795 B
Markdown
45 lines
795 B
Markdown
---
|
|
title: Prettier
|
|
homepage: https://prettier.io/
|
|
tagline: |
|
|
Prettier is an opinionated code formatter.
|
|
---
|
|
|
|
## Updating `prettier`
|
|
|
|
```bash
|
|
npm install -g prettier@latest
|
|
```
|
|
|
|
## Cheat Sheet
|
|
|
|
> The core value of Prettier is not in what it gives, but in what it takes away:
|
|
> countless hours of bikeshedding over code style choices. Also, it makes git
|
|
> merges much nicer.
|
|
|
|
Prettify all web files in a project, recursively:
|
|
|
|
```bash
|
|
prettier --write '**/*{.md,.js,.html,.css}'
|
|
```
|
|
|
|
Tell Prettier which files to ignore every time
|
|
|
|
```bash
|
|
echo "dist/" >> .prettierignore
|
|
```
|
|
|
|
Tell Prettier which settings to use - do NOT use `package.json` when it's not
|
|
necessary!
|
|
|
|
**`.prettierrc`**:
|
|
|
|
```bash
|
|
{
|
|
"trailingComma": "none",
|
|
"tabWidth": 2,
|
|
"singleQuote": true,
|
|
"proseWrap": "always"
|
|
}
|
|
```
|