From 5065608f7367ed9affa806d7aa24e99a492c69fd Mon Sep 17 00:00:00 2001 From: Roger Sheen Date: Tue, 12 Dec 2017 01:23:06 +0100 Subject: [PATCH] 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. --- docs/cli.md | 2 +- docs/ignore.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index 59fa7215..16345cf8 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -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`. diff --git a/docs/ignore.md b/docs/ignore.md index a64b32b1..b69c4cc0 100644 --- a/docs/ignore.md +++ b/docs/ignore.md @@ -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