Fix empty Prettier config file create command (#15367)

This commit is contained in:
fisker Cheung authored and GitHub committed 2023-09-14 10:27:26 +08:00
1 parent bf7d90ae84
commit f7959cccbf
2 files changed
+14 -4

No files matched your search

+7 -2
View File
@@ -28,10 +28,15 @@ pnpm add --save-dev --save-exact prettier
Then, create an empty config file to let editors and other tools know you are using Prettier: Then, create an empty config file to let editors and other tools know you are using Prettier:
<!-- Note: `echo "{}" > .prettierrc.json` would result in `"{}"<SPACE>` on Windows. The below version works in cmd.exe, bash, zsh, fish. --> <!--
Note:
- `echo "{}" > .prettierrc` would result in `"{}"<SPACE>` on Windows.
- `echo {}> .prettierrc` would result the file in UTF-16LE encoding in PowerShell.
The below version works in cmd.exe, bash, zsh, fish, PowerShell.
-->
```bash ```bash
echo {}> .prettierrc.json node --eval "fs.writeFileSync('.prettierrc','{}\n')"
``` ```
Next, create a [.prettierignore](ignore.md) file to let the Prettier CLI and editors know which files to _not_ format. Here’s an example: Next, create a [.prettierignore](ignore.md) file to let the Prettier CLI and editors know which files to _not_ format. Here’s an example:
@@ -29,10 +29,15 @@ pnpm add --save-dev --save-exact prettier
Then, create an empty config file to let editors and other tools know you are using Prettier: Then, create an empty config file to let editors and other tools know you are using Prettier:
<!-- Note: `echo "{}" > .prettierrc.json` would result in `"{}"<SPACE>` on Windows. The below version works in cmd.exe, bash, zsh, fish. --> <!--
Note:
- `echo "{}" > .prettierrc` would result in `"{}"<SPACE>` on Windows.
- `echo {}> .prettierrc` would result the file in UTF-16LE encoding in PowerShell.
The below version works in cmd.exe, bash, zsh, fish, PowerShell.
-->
```bash ```bash
echo {}> .prettierrc.json node --eval "fs.writeFileSync('.prettierrc','{}\n')"
``` ```
Next, create a [.prettierignore](ignore.md) file to let the Prettier CLI and editors know which files to _not_ format. Here’s an example: Next, create a [.prettierignore](ignore.md) file to let the Prettier CLI and editors know which files to _not_ format. Here’s an example: