Skip to content

Upgrade prettier-plugin-astro to 1.x (blocked on prettier-config) #1629

Open

Description

@joshunrau

prettier-plugin-astro is held at 0.14.1, its last 0.x release, in the root package.json by the dependency update on the deps branch. The newest release eligible under the repo's 7-day minimumReleaseAge on 2026-10-04 was 1.1.0.

Why it was not upgraded

@douglasneuroinformatics/prettier-config@0.3.0 peers prettier-plugin-astro 0.x.

What is required

  1. A prettier-config release that peers prettier-plugin-astro ^1. Version 1.1.0 needs Node ≥ 22.12 and Prettier ≥ 3.5.3, and this repo already meets both.
  2. Bump the plugin, run pnpm format, and review how the .astro files in apps/outreach are reformatted.

Activity

  1. added
    Priority: Low
    Difficulty: Low
    Chore
    Area: Infrastructure
    Upstream
    on Oct 5, 2026
  2. joshunrau commented on Oct 26, 2026

    @joshunrau
    CollaboratorAuthor

    Still blocked on main (d86740e), but prettier-config is no longer the blocker. package.json:39-53 still pins prettier-config ^0.3.0 and prettier-plugin-astro ^0.14.1.

    The blocker is now prettier-plugin-tailwindcss

    @douglasneuroinformatics/prettier-config@0.4.0 (2026-10-06) peers prettier-plugin-astro: "0.x || 1.x", and #1660 bumps to it in 6b0ad61. That commit keeps the astro plugin on 0.14.1 because of the Tailwind plugin. Plugin 1.x parses with @astrojs/compiler-rs and returns an ESTree/JSX AST. The Astro transform in prettier-plugin-tailwindcss 0.8.1 only matches the element and attribute nodes from 0.x. So it sorts nothing, and it reports no error. tailwindlabs/prettier-plugin-tailwindcss#473 fixes this (merged 2026-09-29), but the fix is still under "Unreleased" in their CHANGELOG. 0.8.1 (2026-07-15) is the latest stable release, and the fix ships only in 0.0.0-insiders.5b27f94.

    Results for a probe file, formatted with prettier 3.9.9 and our createConfig options:

    astro plugin tailwind plugin class="…" class:list class={cn(…)}
    0.14.1 0.8.1 sorted sorted not sorted
    1.1.2 0.8.1 not sorted not sorted not sorted
    1.1.2 insiders.5b27f94 sorted sorted sorted

    No CI job runs prettier. Only prettier-pre-commit in .husky/pre-commit does, and only on staged files. So if the astro plugin were bumped on its own, sorting would stop and nothing would flag it. Both plugins have to move in the same commit.

    The reformat

    I ran 1.1.2 with the insiders build over the 34 .astro files on main, all of which are in apps/outreach. All 34 parse and 17 change, and 1.1.1 gives the same output. The new printer is JSX-style:

    • a single long attribute stays on the tag line, even past 120 columns
    • >\n</path> collapses to ></path>
    • { … } expression blocks lose their brace-only lines
    • .map((x) => <X />) gains parentheses

    Most of the diff is Medical.astro, which goes from 800 lines to 717.

    I compiled each changed file before and after with Astro 5's @astrojs/compiler 2.13.1, with compact: true to match compressHTML at astro.config.ts:24. With whitespace ignored, three files compile differently:

    • Header.astro, because of the added parentheses
    • Headshot.astro and Feature.astro, because their cn(…) class lists now get sorted

    In the emitted HTML, only whitespace changes:

    • The <h1> in PageHeading.astro and the <p> in Hero.astro and Feature.astro lose the spaces around their expression.
    • Medical.astro gains spaces between SVG children. It has no <text> element.

    None of this changes how the pages render.

    Landing order

    Plan

    1. Wait for two things: build: upgrade dependencies held back by breaking changes #1660 merges, and a stable Tailwind release with the fix is 7 days old. Then bump prettier-plugin-astro to ^1.1.2 and prettier-plugin-tailwindcss together in one build: commit. If that release is 1.0, the 0.x peer in prettier-config 0.4.0 blocks it again, and prettier-config needs another release.
    2. Run pnpm format and commit the result separately as style(outreach). With the insiders build, nothing outside apps/outreach changes: none of the 435 .tsx, .jsx, .css and .html files elsewhere on main move. If the stable release changes any of them, review those changes first.
    3. Verify:
      • run pnpm --filter @opendatacapture/outreach lint
      • diff the outreach build output before and after. Expect only the whitespace above and the two reordered class lists.
      • unsort one class by hand, and confirm the formatter sorts it again

    This needs the same exception #1660 got for prettier-config, lint and a format check only. No unit or e2e test can see a formatter change, and outreach has no test suite.

    Suggest retitling this to "blocked on prettier-plugin-tailwindcss".

    Triage note written with Claude Code. Code references point at main @ d86740e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: InfrastructureChoreDifficulty: LowPriority: LowUpstream

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions