Docs: Add info on ignore file to "Ignoring Code" (#3458)

* docs(ignore): mention ignore file in Ignoring Code

While working on #3321, I needed to ignore an entire file, but the "Ignoring Code" section of the docs only describes how to ignore blocks of code, so I wasn't aware of the default ignore file.

(The `.prettierignore` file is mentioned in the CLI section, but easily overlooked there.)

This commit extends the introduction sentence of the "Ignoring Code" section and adds a new subsection to explain how to ignore files.

https://github.com/prettier/prettier/issues/3321#issuecomment-350072566

* docs(cli): fix nesting error in heading hierarchy

The `--ignore-path` option currently appears as a third-level subsection of `--find-config-path` and `--config`, but this looks like an error.

This commit promotes the `--ignore-path` heading to the same (H2) level as the other CLI options.
master
Roger Sheen 2017-12-12 01:23:06 +01:00 committed by Lucas Duailibe
parent d00d09bb87
commit 5065608f73
2 changed files with 6 additions and 2 deletions

View File

@ -44,7 +44,7 @@ You can also use `--config` if your configuration file lives somewhere where pre
If you don't have a configuration file, or want to ignore it if it does exist, you can pass `--no-config` instead.
### `--ignore-path`
## `--ignore-path`
Path to a file containing patterns that describe files to ignore. By default, prettier looks for `./.prettierignore`.

View File

@ -3,7 +3,11 @@ id: ignore
title: Ignoring Code
---
Prettier offers an escape hatch to ignore a block of code from being formatted.
Prettier offers an escape hatch to ignore a block of code or prevent entire files from being formatted.
## Ignoring Files
To exclude files from formatting, add entries to a `.prettierignore` file in the project root or set the `--ignore-path` [CLI](cli.md) option.
## JavaScript