withastro / prettier-plugin-astro

Prettier plugin for Astro
Other
479 stars 36 forks source link

🐛 BUG: Formatting failing with alpinejs short hand for `x-bind` -> `:` #427

Open 22ispencer opened 2 months ago

22ispencer commented 2 months ago

Describe the Bug

I use Neovim as my editor, formatting was working fine until I used :value as a shorthand for x-bind:value for alpinejs. When i run prettier from the cli (prettier MY_FILE --write) it gives me the error "SyntaxError: Unexpected token" with a caret pointing to the colon. Writing out the long form x-bind:value works fine.

Steps to Reproduce

  1. Edit a file in an astro repo (with the prettier plugin) to have : prefixing any html tag
  2. try formatting the document, either through the editor or cli