chore: setup markdown formatting (#3224)
* chore(deps): upgrade prettier to v1.8.2 * chore: setup lint-docs script * docs: add `<!-- prettier-ignore -->`s * docs: format docs * Revert "docs: format docs" This reverts commit 6dba903987dddc498cb589ca311905f25b6aee53. * chore(prettierrc): set `--no-prose-wrap` * docs: format docs * Revert "docs: format docs" This reverts commit 139bd744b6921916be8fac4fa3bab83bae5d12df. * docs: tweak * docs: format docs * chore: rename .prettierrc * chore: rename back to .prettierrc * chore: split out third-party * refactor: fix linting * chore: do not split out third-party on website
This commit is contained in:
1 parent
a0c95cf862
commit
76efb33e75
35 files changed
+525
-436
No files matched your search
+12
-23
@@ -3,11 +3,9 @@ id: cli
|
||||
title: CLI
|
||||
---
|
||||
|
||||
Run Prettier through the CLI with this script. Run it without any
|
||||
arguments to see the [options](options.md).
|
||||
Run Prettier through the CLI with this script. Run it without any arguments to see the [options](options.md).
|
||||
|
||||
To format a file in-place, use `--write`. You may want to consider
|
||||
committing your code before doing that, just in case.
|
||||
To format a file in-place, use `--write`. You may want to consider committing your code before doing that, just in case.
|
||||
|
||||
```bash
|
||||
prettier [opts] [filename ...]
|
||||
@@ -19,24 +17,17 @@ In practice, this may look something like:
|
||||
prettier --single-quote --trailing-comma es5 --write "{app,__{tests,mocks}__}/**/*.js"
|
||||
```
|
||||
|
||||
Don't forget the quotes around the globs! The quotes make sure that Prettier
|
||||
expands the globs rather than your shell, for cross-platform usage.
|
||||
The [glob syntax from the glob module](https://github.com/isaacs/node-glob/blob/master/README.md#glob-primer)
|
||||
is used.
|
||||
Don't forget the quotes around the globs! The quotes make sure that Prettier expands the globs rather than your shell, for cross-platform usage. The [glob syntax from the glob module](https://github.com/isaacs/node-glob/blob/master/README.md#glob-primer) is used.
|
||||
|
||||
Prettier CLI will ignore files located in `node_modules` directory. To opt-out from this behavior use `--with-node-modules` flag.
|
||||
|
||||
## `--debug-check`
|
||||
|
||||
If you're worried that Prettier will change the correctness of your code, add `--debug-check` to the command.
|
||||
This will cause Prettier to print an error message if it detects that code correctness might have changed.
|
||||
Note that `--write` cannot be used with `--debug-check`.
|
||||
If you're worried that Prettier will change the correctness of your code, add `--debug-check` to the command. This will cause Prettier to print an error message if it detects that code correctness might have changed. Note that `--write` cannot be used with `--debug-check`.
|
||||
|
||||
## `--find-config-path` and `--config`
|
||||
|
||||
If you are repeatedly formatting individual files with `prettier`, you will incur a small performance cost
|
||||
when prettier attempts to look up a [configuration file](configuration.md). In order to skip this, you may
|
||||
ask prettier to find the config file once, and re-use it later on.
|
||||
If you are repeatedly formatting individual files with `prettier`, you will incur a small performance cost when prettier attempts to look up a [configuration file](configuration.md). In order to skip this, you may ask prettier to find the config file once, and re-use it later on.
|
||||
|
||||
```bash
|
||||
prettier --find-config-path ./my/file.js
|
||||
@@ -49,19 +40,18 @@ This will provide you with a path to the configuration file, which you can pass
|
||||
prettier --config ./my/.prettierrc --write ./my/file.js
|
||||
```
|
||||
|
||||
You can also use `--config` if your configuration file lives somewhere where prettier cannot find it,
|
||||
such as a `config/` directory.
|
||||
You can also use `--config` if your configuration file lives somewhere where prettier cannot find it, such as a `config/` directory.
|
||||
|
||||
If you don't have a configuration file, or want to ignore it if it does exist,
|
||||
you can pass `--no-config` instead.
|
||||
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`
|
||||
|
||||
Path to a file containing patterns that describe files to ignore. By default, prettier looks for `./.prettierignore`.
|
||||
Path to a file containing patterns that describe files to ignore. By default, prettier looks for `./.prettierignore`.
|
||||
|
||||
## `--require-pragma`
|
||||
|
||||
Require a special comment, called a pragma, to be present in the file's first docblock comment in order for prettier to format it.
|
||||
|
||||
```js
|
||||
/**
|
||||
* @prettier
|
||||
@@ -72,8 +62,7 @@ Valid pragmas are `@prettier` and `@format`.
|
||||
|
||||
## `--insert-pragma`
|
||||
|
||||
Insert a `@format` pragma to the top of formatted files when pragma is absent.
|
||||
Works well when used in tandem with `--require-pragma`.
|
||||
Insert a `@format` pragma to the top of formatted files when pragma is absent. Works well when used in tandem with `--require-pragma`.
|
||||
|
||||
## `--list-different`
|
||||
|
||||
@@ -85,7 +74,7 @@ prettier --single-quote --list-different "src/**/*.js"
|
||||
|
||||
## `--no-config`
|
||||
|
||||
Do not look for a configuration file. The default settings will be used.
|
||||
Do not look for a configuration file. The default settings will be used.
|
||||
|
||||
## `--config-precedence`
|
||||
|
||||
@@ -111,4 +100,4 @@ Prettier CLI will ignore files located in `node_modules` directory. To opt-out f
|
||||
|
||||
## `--write`
|
||||
|
||||
This rewrites all processed files in place. This is comparable to the `eslint --fix` workflow.
|
||||
This rewrites all processed files in place. This is comparable to the `eslint --fix` workflow.
|
||||
Reference in new issue
Block a user