Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: Not always respecting bracketSameLine option #364

Open
alexpdraper opened this issue Jul 24, 2023 · 0 comments
Open

🐛 BUG: Not always respecting bracketSameLine option #364

alexpdraper opened this issue Jul 24, 2023 · 0 comments
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@alexpdraper
Copy link

Describe the Bug

Empty with multiple attributes do not always format as expected with the bracketSameLine option. The following is how Prettier formats this as HTML.

<script
  is:inline
  src="https://www.example.com/path/that/is/kinda/long/ish/"
  async
></script>

<span
  id="important-span"
  class="some class and another one"
  data-check="for sure"
  >{value}</span
>

But, Astro formats this as:

<script
  is:inline
  src="https://www.example.com/path/that/is/kinda/long/ish/"
  async></script>

<span
  id="important-span"
  class="some class and another one"
  data-check="for sure">{value}</span
>

Setting the bracketSameLine option doesn’t change the output at all.

Steps to Reproduce

  1. npm create astro@latest using template Empty
  2. npm install --save-dev prettier prettier-plugin-astro
  3. Add a prettier config
// prettier.config.cjs
module.exports = {
  plugins: [require.resolve("prettier-plugin-astro")],
  overrides: [
    {
      files: ["**/*.astro"],
      options: { parser: "astro" },
    },
  ],
};
  1. Create an astro file with a template like the ones described in the bug above
  2. Format the new file and see it look as described
@Princesseuh Princesseuh added the needs triage Issue needs to be triaged label Nov 28, 2023
@Princesseuh Princesseuh added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

2 participants