As I reported in #8815, prettier doesn't support UTF-16LE config files. The documentation still gives instructions that will result in a UTF-16LE file and give users very confusing instructions. I ran into this again, 2 years later while setting up a new project. Powershell is a very common terminal for Windows developers to work in and I'm sure this will result in confusion by others as well.
Environments:
- Prettier Version: 2.8.0
- Running Prettier via:
npx prettier --write .
- Runtime: Powershell inside of vscode
- Operating System: Windows 10
- Prettier plugins (if any): N/A
Steps to reproduce:
Follow the installation instructions in a powershell prompt:
npm install --save-dev --save-exact prettier
echo {}> .prettierrc.json <--- the problematic command
npx prettier --write .
Expected behavior:
Prettier recognizes an empty json config file
Actual behavior:
You get the hideous error message:
[error] Invalid configuration file `.prettierrc.json`: JSON Error in <file path>\.prettierrc.json:
[error]
[error] > 1 | ��
[error] | ^
[error] 2 |
[error] 3 |
[error]
[error] Unexpected token "�" (0xFFFD) in JSON at position 0 while parsing "��\r\u0000\n\u0000"
[error]
[error] > 1 | ��
[error] | ^
[error] 2 |
[error] 3 |
[error]
Saving the file with UTF-8 encoding produces the expected result of running with an empty config file.
As I reported in #8815, prettier doesn't support UTF-16LE config files. The documentation still gives instructions that will result in a UTF-16LE file and give users very confusing instructions. I ran into this again, 2 years later while setting up a new project. Powershell is a very common terminal for Windows developers to work in and I'm sure this will result in confusion by others as well.
Environments:
npx prettier --write .Steps to reproduce:
Follow the installation instructions in a powershell prompt:
npm install --save-dev --save-exact prettierecho {}> .prettierrc.json<--- the problematic commandnpx prettier --write .Expected behavior:
Prettier recognizes an empty json config file
Actual behavior:
You get the hideous error message:
Saving the file with UTF-8 encoding produces the expected result of running with an empty config file.