Repository navigation
fix: print code copied from source validly without a JS parser - #150
Merged
Merged
Conversation
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 detectedLatest commit: 0ba11a2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 itsasyncor 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. Theasynckeyword 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