Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Prettier v3 doesn't run on .liquid files unless specified #208

Closed
andershagbard opened this issue Sep 15, 2023 · 8 comments
Closed

Prettier v3 doesn't run on .liquid files unless specified #208

andershagbard opened this issue Sep 15, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@andershagbard
Copy link

Describe the bug
In Prettier v2, it was possible to just use prettier ., and it would run on on all files, including .liquid files.
In Prettier v3, you have to use prettier --write '**/*.liquid' to make it run on .liquid files.

Debugging information

  • MacOS
  • prettier-plugin-liquid v.1.2.2
  • prettier 3.0.3
@andershagbard andershagbard added the bug Something isn't working label Sep 15, 2023
@charlespwd
Copy link
Collaborator

Yep that's a v3 breaking change from prettier unfortunately. I'm not happy with how they communicated it.

Try adding this to your .prettierrc.json

{
  "plugins": ["@shopify/prettier-plugin-liquid"]
}

prettier/prettier#15088

@andershagbard
Copy link
Author

Already have it in my config.

{
  "$schema": "https://json.schemastore.org/prettierrc.json",
  "printWidth": 100,
  "singleQuote": true,
  "plugins": ["@shopify/prettier-plugin-liquid", "prettier-plugin-tailwindcss"],
  "overrides": [
    {
      "files": ["**/*.liquid"],
      "options": {
        "singleQuote": false
      }
    }
  ]
}

@charlespwd
Copy link
Collaborator

I otherwise have no idea. Couldn't find a meaningful API change from their docs that says we should be doing something different on our end. Did they hardcode a default pattern in v3? Doesn't seem to be anything about that in the migration docs either...

@andershagbard
Copy link
Author

Seems like a bug in Prettier. It semi-ignores my config file.

Running prettier using yarn prettier . --write --plugin="@shopify/prettier-plugin-liquid" --plugin="prettier-plugin-tailwindcss" works as expected.

@andershagbard
Copy link
Author

Confirmed bug in prettier. Progress can be followed in this issue: prettier/prettier#15079

@emilqva
Copy link

emilqva commented Mar 22, 2024

Just add this to settings.json in vscode:

{
"[liquid]": {
    "editor.defaultFormatter": "Shopify.theme-check-vscode",
    "editor.formatOnSave": true
  },
}

This will also enable format on save.

@Velkamhell97
Copy link

Any solution ?

@andershagbard
Copy link
Author

Any solution ?

Should be working now. Just update your packages

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants