Closed paolodina closed 2 years ago
It's also uncommon that after prettier has run, adding the fixed files to git gives:
$ git add .
...
warning: CRLF will be replaced by LF in src/components/layout/AppBreadcrumbs.vue.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in src/components/layout/AppDrawer.vue.
The file will have its original line endings in your working directory
...
Thank you very much, @paolodina !
You are right. editorconfig
can be removed from .prettierrc
as it will always be read by Prettier. I've never used Prettier CLI before, so I didn't notice this issue. We use Prettier extension and source files are automatically formatted when saved. It's a good idea to add a custom script to package.json
or benefit git hooks to format code.
As all of my teammates are coding on Windows, I set eol
to crlf
. If you are using Linux, it is recommended to set lf
as eol
in .editorconfig
.
end_of_line = lf
You can also select eol on status bar of VSCode.
warning: CRLF will be replaced by LF
As for the warning, I cannot reproduce it on my computer. I will investigate how to avoid this warning on different OS and with different git config. Maybe we should prevent git from converting eol.
Oh I forgot one thing. Maybe we don't need a custom prettier script, because we already have pnpm lint
.
ESlint in this template is configured with eslint-plugin-prettier
.
If you run pnpm lint
, your code will be formatted according to prettier style.
All clear, thanks!
Hi and thanks for the wonderful work you did.
After cloning the repo and open some file I see a lot of prettier warnings like
Not a huge problem, but I tried to run prettier manually getting another kind of warning
Now:
editorconfig
from.prettierrc
, (https://github.com/prettier/prettier/issues/6176#issuecomment-498808239). I tried and seems to work well.package.json
to run prettier