Skip to content

feat: report comments that stand alone in an open tag - #248

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

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

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

A // or /* */ comment that stood alone in an open tag, eg <div /* c */ class="box"> or a // why line between attributes, was consumed without any event, so consumers such as prettier-plugin-marko dropped it. It is now reported through a new onOpenTagComment handler. A comment that follows a value is still part of that value, like any comment inside JavaScript code.

It is a separate handler from onComment because existing consumers add every onComment to the current body, which would move these comments into the tag's body (and give a void tag like <input> a body); with a new handler they see no change until they opt in. The content states and the open tag now share one helper for a JS comment's range.

🤖 Generated with Claude Code

`OPEN_TAG.return` ignored every child but an expression, so a `//` or
`/* */` comment that did not follow a value was consumed without an event,
and consumers dropped it. It is now reported through a new
`onOpenTagComment` handler, separate from `onComment` so that consumers
which add every comment to the current body are unaffected until they
handle it. A comment that follows a value is still part of it, like a
comment anywhere else inside JavaScript code.

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: 6c3597f

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

This PR includes changesets to release 1 package
Name Type
htmljs-parser Minor

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 99.95%. Comparing base (afdd9bc) to head (6c3597f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #248   +/-   ##
=======================================
  Coverage   99.95%   99.95%           
=======================================
  Files          35       35           
  Lines        4604     4611    +7     
  Branches      882      888    +6     
=======================================
+ Hits         4602     4609    +7     
  Misses          2        2           

☔ 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 430e74d into main Sep 23, 2026
11 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 23, 2026
@DylanPiercey
DylanPiercey deleted the dpiercey-ws-prettier-marko-async-ulp3vg-open-tag-comments branch September 23, 2026 18:46
@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