Looking at the Prettier docs, there is a tip to base your .prettierignore file on your .gitignore file.
https://prettier.io/docs/en/install.html
Tip! Base your .prettierignore on .gitignore and .eslintignore (if you have one).
Can someone explain what this means and how to do this? Is there a way to automatically add everything to your .prettierignore included in your .gitignore?
You can actually pass a flag to your prettier command --ignore-path
and then give it the path of your .gitignore
file so it will use that instead of the .prettierignore
file.
prettier --ignore-path .gitignore
They're not implying there's an automatic way to do this, but you could cp .gitignore .prettierignore
(or copy it some other way, such as in your IDE). There is a proposal to include other ignore files as well as a node tool to automate this for you if you want to, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With