theme-tools icon indicating copy to clipboard operation
theme-tools copied to clipboard

Respect .prettierignore when formatting local files

Open dejmedus opened this issue 3 months ago • 0 comments

  • partially fixes https://github.com/Shopify/theme-tools/issues/379

What are you adding in this PR?

Previously, the extension used liquid prettier plugin to format all files regardless of whether it was ignored by a .prettierignore file in the workspace. Although we aren't able to respect.prettierignore in all environments (for instance in browser or remote filesystems) we can in nodePrettierFormat

This PR checks for a .prettierignore at the workspace root and does not format files that .getFileInfo determines should be ignored

demo

https://github.com/user-attachments/assets/5a868e6d-9bd5-4123-a3ce-a495634b25a9

What did you learn?

  • Unlike other prettier config:
    • there is only one possible ignore file name
    • prettier looks for .prettierignore files at workspace root (though its being discussed)

Before you deploy

  • [x] I included a minor bump changeset
  • [x] My feature is backward compatible

dejmedus avatar Sep 16 '25 23:09 dejmedus