I have a very weird problem and I would be happy if anyone could (please) help :)
I have an NX project (created in a Linux env), and I'm now using it on windows.
My VSCode uses the latest prettier version -->> prettier v9.10.3
.
My (monorepo NX) project uses the latest prettier version -->> prettier v2.8.1
.
My .preetierrc
file is intentionally empty because my team uses the default prettier settings, and all of my files have been formatted using prettier-vscode-plugin which is my default formatter.
I did git pull
and npm i
and everything works perfectly.
When I run
prettier --check "apps\stt-monitor-front-end\src\app\components\CallCardsContainer.component.tsx"
on a specific file/folder it always fails with the
Code style issues found in the above file. Forgot to run Prettier?
message, although I know for sure that the file/folder has been prettier
ized in my VSCode.
** In fact, even If I delete the entire file's content and write const x = 5; with prettier plugin activated it still fails.
My main concern --->> prettier --write
fixes the problem but it changes (not really) the entire file and it's like I created a new file, although everything is exactly the same!
Something is definitely wrong and I don't know how to fix it.
In addition, even if I do use prettier --write
for the entire project my VSCode-prettier-plugin won't change any of the files because it works properly.
I figured it out after hours of googling.
https://prettier.io/docs/en/options.html#end-of-line
The project was created on Linux and the “End of Line” style in Linux and Windows looks the same but it’s not the same.
I added:
“endOfLine”: “auto”
to my .prettierrc
file :)
And everything worked!