Document recommended setup and improve docs overall (#8510)

Co-authored-by: Jed Fox <git@twopointzero.us>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
This commit is contained in:
authored and GitHub committed 2020-06-28 09:47:29 +08:00
1 parent 0c2b918078
commit 554b15473d
35 files changed
+424 -519

No files matched your search

+20 -3
View File
@@ -3,11 +3,28 @@ id: ignore
title: Ignoring Code
---
Prettier offers an escape hatch to ignore a block of code or prevent entire files from being formatted.
Use `.prettierignore` to ignore (i.e. not reformat) certain files and folders completely.
## Ignoring Files
Use “prettier-ignore” comments to ignore parts of files.
To exclude files from formatting, add entries to a `.prettierignore` file in the project root or set the [`--ignore-path` CLI option](cli.md#--ignore-path). `.prettierignore` uses [gitignore syntax](https://git-scm.com/docs/gitignore#_pattern_format).
## Ignoring Files: .prettierignore
To exclude files from formatting, create a `.prettierignore` file in the root of your project. `.prettierignore` uses [gitignore syntax](https://git-scm.com/docs/gitignore#_pattern_format).
Example:
```
# Ignore artifacts:
build
coverage
# Ignore all HTML files:
*.html
```
It’s recommended to have a `.prettierignore` in your project! This way you can run `prettier --write .` to make sure that everything is formatted (without mangling files you don’t want, or choking on generated files). And – your editor will know which files _not_ to format!
(See also the [`--ignore-path` CLI option](cli.md#--ignore-path).)
## JavaScript