Open snebjorn opened 4 years ago
Can you provide a github repo I can use to duplicate this? Everything in the log output is correct (the output config only shows overridden info so the endOfLine is set to default).
Sure https://github.com/datorama/akita But line ending on checkout depend on your git settings and that one have
# .gitattributes
* text=auto
Still prettier should complain about every line in every file as I'm running on Windows
I discovered this when I added https://github.com/prettier/eslint-plugin-prettier to the eslint rules. Because it went absolutely nuts and complained about every line in every file :)
Can you tell me if you run prettier from the CLI does it fix the line endings correctly?
Yep.
checking format
❯ yarn prettier --check .\libs\akita\src\lib\updateEntities.ts
yarn run v1.22.0
$ ~\Repos\akita\node_modules\.bin\prettier --check .\libs\akita\src\lib\updateEntities.ts
Checking formatting...
libs\akita\src\lib\updateEntities.ts
Code style issues found in the above file(s). Forgot to run Prettier?
error Command failed with exit code 1.
formatting
❯ yarn prettier --write .\libs\akita\src\lib\updateEntities.ts
yarn run v1.22.0
$ ~\Repos\akita\node_modules\.bin\prettier --write .\libs\akita\src\lib\updateEntities.ts
libs\akita\src\lib\updateEntities.ts 169ms
Done in 0.47s.
after running prettier --write
VSCode now shows
@ntotten are you not able to reproduce this? Can I assist any further?
Same here. While editorconfig vscode plugin takes effect.
Same here with vscode as well
It seems that even "endOfLine": "lf"
doesn't work in VS Code automatically (without running Prettier via CLI).
It might make sense to check the implementation of the EditorConfig extension to use the same way to override VS Code's newline settings.
I have the same problem,VS code Prettier not work,but Prettier CLI work correctly 😐
add .editorconfig file can work
This is still a problem, on vscode my settings are to have the end line as lf
, my .prettier.json
also has lf
but still inserts crlf
This is still a problem, on vscode my settings are to have the end line as
lf
, my.prettier.json
also haslf
but still insertscrlf
i was playing with it, but end up with using
git config --global core.autocrlf input
it covers what i actually need :)
I'm having the same issue. CLI works, vscode format with prettier doesn't
I have this problem too, as it doesn't convert EOLs on "Format document" command. Any updates on this?
still doesn't work, it's been over 4 years now, lol.
Summary
Line endings was changed from auto to LF in prettier v2.0.0. However this doesn't change CRLF files to LF when formatting.
Github Repository to Reproduce Issue
Any CRLF file prettier supports will do
Steps To Reproduce:
Use prettier v2 default config
Expected result
Prettier should report line ending errors. Prettier should change line endings to LF on format.
Actual result
Line endings are still CRLF after formatting.
Additional information
VS Code Version: 1.44.1
Prettier Extension Version: 4.4.0
OS and version: Windows 1909
.prettierrc
.editorconfig
Prettier Log Output