Skip to content

fix: print code copied from source validly without a JS parser - #150

Merged
DylanPiercey merged 1 commit into
mainfrom
dpiercey-ws-prettier-marko-async-ulp3vg
Sep 23, 2026
Merged

DylanPiercey merged 1 commit into
mainfrom
dpiercey-ws-prettier-marko-async-ulp3vg

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

Without a JS parser (eg prettier/standalone, which the docs site uses) or when code fails to parse, the printer copies attrs and scriptlets from source. An async shorthand method lost its async or glued it to the tag name, a scriptlet lost its $, and an attr value ending in a line comment or spanning lines swallowed or split the rest of the tag. The async keyword is now printed rather than copied, values htmljs-parser does not report as enclosed are wrapped in parens, and scriptlets rely on htmljs-parser 5.15.1 starting their range at $.

Every fixture now also runs without a JS parser, and the fixture guard compares the compiled tags, attrs and JS rather than only text. Dependencies are updated; typescript-eslint does not load with TypeScript 7, so linting moves to oxlint, and the Marko 5 fixtures compile with Marko 5's translator. Supersedes #149.

🤖 Generated with Claude Code

Without a JS parser, eg `prettier/standalone`, or when code fails to parse,
the printer copies attrs and scriptlets from source. An async method lost
its `async` (or glued it to the tag name), a scriptlet lost its `$`, and an
attr value ending in a line comment or spanning lines swallowed or split the
rest of the tag. The async keyword is now printed rather than copied, values
that htmljs-parser does not report as enclosed are wrapped in parens, and
scriptlets rely on htmljs-parser 5.15.1 starting their range at `$`.

Every fixture now also runs without a JS parser, and the fixture guard
compares the compiled tags, attrs and JS, not just text. Dependencies are
updated; typescript-eslint does not load with TypeScript 7, so lint moves to
oxlint, and the Marko 5 fixtures compile with Marko 5's translator.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0ba11a2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
prettier-plugin-marko Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.16%. Comparing base (272ee0d) to head (0ba11a2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #150      +/-   ##
==========================================
+ Coverage   96.86%   97.16%   +0.30%     
==========================================
  Files           8        8              
  Lines         319      318       -1     
  Branches       54       56       +2     
==========================================
  Hits          309      309              
+ Misses          4        3       -1     
  Partials        6        6              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DylanPiercey
DylanPiercey merged commit 81b16c8 into main Sep 23, 2026
11 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 23, 2026
@DylanPiercey DylanPiercey moved this to Done in Roadmap Oct 2, 2026
@DylanPiercey DylanPiercey self-assigned this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant