Skip to content

🐛 BUG: singleQuote: true does not correctly apply to astro files #439

@Levelleor

Description

@Levelleor

Describe the Bug

Here's a piece of code from recommended example starter:

---
import astroLogo from "../assets/astro.svg";
import background from "../assets/background.svg";
---

<div id="container">
	<img id="background" src={background.src} alt="" fetchpriority="high" />
	<main>
		<section id="hero">

When running prettier against it the output is:

---
import astroLogo from '../assets/astro.svg';
import background from '../assets/background.svg';
---

<div id="container">
	<img id="background" src={background.src} alt="" fetchpriority="high" />
	<main>
		<section id="hero">

Notice how only the javascript at the top has changed to single quotes and not the rest of the code.

Steps to Reproduce

  1. npm create astro@latest using template "A basic, helpful starter project"
  2. add .prettierrc file to root
  3. add following content to prettier:
{
  "singleQuote": true,
  "bracketSameLine": true,
  "bracketSpacing": true,
  "htmlWhitespaceSensitivity": "ignore"
}
  1. The output you can find above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions