Repository navigation
feat(tsrx-prettier-plugin): Phase 1 formatting decisions, Prettier-style parse errors, and fixes (#503, #504, #505, #509) - #511
Merged
Conversation
Cover what was added after the first version: recovered markup is an error,
comments between JSX children and `src/jsx.js`, JSX-style parentheses for
`@{ … }` values and directives, `<script>` body types, standalone use, and
the kinds of overrides.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ADME Whether this plugin replaces `@tsrx/prettier-plugin` or is released on its own is one of the last decisions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…kip cases TSRX reads differently - A line comment between `<` and a tag name goes on its own indented line, with the name and attributes below it, as Prettier lays out a closing tag (Prettier's `<// note` isn't TSX). An element's direct child keeps Prettier's layout, since a `<` followed by a line break there is text. - A block comment before a tag name prints straight after `<` or `</`, in the form Prettier's second format settles on. - Skip Prettier's `callee-comments.ts` (a line-starting `<` is an element in TSRX) and the 6 inputs only TypeScript's error recovery parses (#415). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Sep 25, 2026
leonidaz
added a commit
that referenced
this pull request
Sep 25, 2026
Regenerated prettier-known-failures.json: the 7 cases #511 skips remain. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared a fix for 1 of the 2 issues found in the latest run.
- ✅ Fixed: Dynamic tag comments are dropped
- Commented tag names are now printed for every name node, including a dynamic JSXExpressionContainer, so a comment between < and {Tag} is kept.
Or push these changes by commenting:
@cursor push 06e93e38a8
Preview (06e93e38a8)
diff --git a/packages/tsrx-prettier-plugin/src/printer.js b/packages/tsrx-prettier-plugin/src/printer.js
--- a/packages/tsrx-prettier-plugin/src/printer.js
+++ b/packages/tsrx-prettier-plugin/src/printer.js
@@ -423,6 +423,11 @@
function printTsrx(path, options, print) {
const { node, parent } = path;
+ // `willPrintOwnComments` claims every commented tag name, including a
+ // dynamic `<{Tag}>` whose name is a `JSXExpressionContainer`. Print it
+ // here; otherwise Prettier skips the comment.
+ if (isCommentedTagName(path)) return printTagNameComments(path, options, print);
+
switch (node.tsrxType ?? node.type) {
case 'BlockStatement':
return node.tsrxCodeBlock
@@ -452,11 +457,6 @@
return node.commentType === 'Line' ? [printed, breakParent] : printed;
}
- case 'JSXIdentifier':
- case 'JSXMemberExpression':
- case 'JSXNamespacedName':
- return isCommentedTagName(path) ? printTagNameComments(path, options, print) : null;
-
case 'JSXAttribute':
return node.shorthand ? ['{', print(['value', 'expression']), '}'] : null;
diff --git a/packages/tsrx-prettier-plugin/tests/tsrx.test.js b/packages/tsrx-prettier-plugin/tests/tsrx.test.js
--- a/packages/tsrx-prettier-plugin/tests/tsrx.test.js
+++ b/packages/tsrx-prettier-plugin/tests/tsrx.test.js
@@ -521,6 +521,48 @@
);
});
+ // A dynamic name is a `JSXExpressionContainer`. Its leading comment is still
+ // a tag-name comment, so it keeps the same layout as a static name.
+ test('a comment before a dynamic tag name is kept', async () => {
+ await expectFormat(
+ `const d = <
+ // note
+ {Tag} a="1">x</{Tag}>;
+const e = <div>
+ <// note
+ {Foo.Bar} />
+</div>;
+const f = <{Tag}>x</
+ // note
+ {Tag}>;
+const g = <
+ /* note */
+ {Tag} />;`,
+ `const d = (
+ <
+ // note
+ {Tag}
+ a="1"
+ >
+ x
+ </{Tag}>
+);
+const e = (
+ <div>
+ <// note
+ {Foo.Bar}
+ />
+ </div>
+);
+const f = <{Tag}>x</
+ // note
+ {Tag}
+ >;
+const g = </* note */ {Tag} />;
+`,
+ );
+ });
+
// Prettier prints this on its second format; its first keeps the line breaks.
test('a block comment on its own line prints straight after `<` or `</`', async () => {
await expectFormat(You can send follow-ups to the cloud agent here.
…ugin-roadmap # Conflicts: # packages/tsrx-prettier-plugin/tests/prettier-known-failures.json
This was referenced Sep 25, 2026
…rsers Every parse error, not only broken markup, now carries Prettier's `loc.start` with a 1-based column and ends its message with that position, so Prettier's code frame marks where it is (`'}' expected. (4:1)`). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nch comments (#503, #504, #505, #509) - With `embeddedLanguageFormatting: "off"`, `<style>` and `<script>` bodies are printed as written instead of being emptied or re-spaced (#503). - A nested `@{ … }` in a template is a statement, not a value, so it isn't wrapped in parentheses, which made it unused output (#504). - `@if` and `@try` present themselves as `if` and `try` to Prettier's comment handling, so comments before `@else` and `@catch` land where Prettier puts them before `else` and `catch`; `@catch`'s own comments print before its `@`, which a comment used to split (#505). A comment before `@empty` stays before it, like one before `else`. - The `{` of an `@case` body, and the `import` of an `export import`, are found outside comments (#509). Co-Authored-By: Claude Opus 5.5 <[email protected]>
leonidaz
marked this pull request as ready for review
September 25, 2026 18:44
A comment between `<` and a dynamic tag's `{Tag}` was claimed by the tag-name
comment printing but never printed, which failed the format. A dynamic tag's
name now lays out its comments like any tag name.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue. You can view the agent here.
Reviewed by Cursor Bugbot for commit e847ab3. Configure here.
This was referenced Sep 25, 2026
leonidaz
added a commit
that referenced
this pull request
Sep 27, 2026
…rs, and what an element renders around comments between its children (#630, #639) (#596) * chore(tsrx-prettier-plugin): open the working PR for the plan after #511 The plan, decisions, and state carried over from #511 are in the PR description. Work on the plugin lands here as commits. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(tsrx-prettier-plugin): keep a comment in a class method's type parameters (#630) The adapter moves a class method's type parameters onto its function, as typescript-estree has them, and now also starts the function at them, so a comment inside them belongs to the function instead of the method's name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(tsrx-prettier-plugin): keep what an element renders when a comment is between its children (#639) A comment adds nothing to the text around it: the whitespace on its two sides is one run (#615), which renders a space without a line break, and nothing with one beside an element or the start or end of the children. The adapter now describes each comment group's run (`describeCommentRuns`), including a `{" "}` beside it, and `printCommentChild` prints a run that renders the same: - a significant space is JSX whitespace, which prints `{" "}` where a line breaks, at the start or end of the children when the element breaks, and written out before a line comment, which ends its line; - a line break at the start or end of the children breaks the element when a space in the run would otherwise render; - whitespace and `{" "}`s in the run are printed by the comments; - a line comment after another comment starts its own line, since the parser reads `/* c */ // c` as text. Also fixes `isEmptyDoc`, which judged any doc starting with an empty string empty, and lays out children with such a comment with `fill`, like text. Checked on every sequence of up to three of text, an element, an expression, `{" "}`, a block comment, and a line comment, with no separator, a space, or a line break between them (12,546 cases): each renders the same after formatting, and a second format changes nothing. Before, 137 of the 558 two-part cases didn't. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(tsrx-prettier-plugin): keep the space a {" "} beside a comment renders, and a {" "} with its own comment (#639) - A `{" "}` in a comment's run counts as a space on its side of the comments, so it prints as the run's space instead of being dropped. - Where the comments keep a line break inside the run, the run's space is written out as `{" "}`, since a plain space next to the line break is trimmed. - A line comment after text starts its own line (on the text's line it is text) and always ends its line. - The space around a group of comments goes on one side, chosen once, so a narrow line breaks in one place and the next format is stable. - A `{" "}` with a comment inside is an ordinary child that prints its comment. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.


What this PR is
This is the working PR for the next phase of
tsrx-prettier-plugin, the candidate successor to@tsrx/prettier-plugin. The first version landed in #409. This description holds the plan, the decisions made so far, and everything needed to pick the work up, including by another agent. Work lands here as commits, and this description is updated as items are done.It lands Phase 1 of the plan, and the user decided it merges now, so the plan continues in a new PR when work on the plugin resumes. The changes, all in the private package:
collect: true#415's error-recovery inputs);loc.start, marked in Prettier's code frame);main:embeddedLanguageFormatting: "off",<style>and<script>bodies are kept as written instead of emptied.@{ … }in a template is a statement and gets no parentheses. They made it unused output.@ifand@trypresent themselves asifandtryto Prettier's comment handling, so comments before@elseand@catchland where Prettier puts them beforeelseandcatch.@catch's own comments print before its@, where a comment used to split@catch. A comment before@emptyis kept like one beforeelse.@casebody's{, and theimportofexport import, are found outside comments.Closes #503, closes #504, closes #505, closes #509.
Background
@tsrx/prettier-pluginprints every JavaScript and TypeScript node itself (over 13,000 lines), and it kept drifting from Prettier: dozens of open "Formatter … like Prettier" issues.tsrx-prettier-plugin(packages/tsrx-prettier-plugin, private, not published) instead reuses Prettier's own printer (prettier/plugins/estree) and prints only TSRX syntax itself. It is tested against Prettier's own format tests.usingdeclarations, and new regex syntax because it parses as ES2022 #414), fix(core): continue an expression after an element that starts a statement, and read type parameters on the line after a declaration name (#416, #419) #471 ([Bug]: tsrx-core: Parser rejects or splits off an operator after an element that starts a statement #416, [Bug]: tsrx-core: Parser rejects type parameters that start on the line after a declaration name #419), fix(core): parse JSX spread children and report them as unsupported (#417) #495 ([Bug]: tsrx-core: Parser rejects JSX spread children (<div>{...children}</div>) #417), fix(core): stop an @switch arm body at the end of the input (#492) #497 ([Bug]: tsrx-core: Parser hangs when the input ends inside an @switch case body #492), fix(core): start an element at its<, and continue an element statement across a line break (#467, #496) #500 ([Bug]: tsrx-core: An element or fragment with whitespace or a comment after<starts inside the gap #467, [Bug]: tsrx-core: Parser ends an element statement before an operator on the next line, where TSX continues the expression #496), and in Phase 1 fix(core): readstaticbefore a line break as a modifier, a generic call signature first in an interface, a class named after a contextual keyword, andassertafter an import (#439, #420, #421, #423) #551 ([Bug]: tsrx-core: Parser readsstaticbefore a line break as a field name, making static members instance members #439, [Bug]: tsrx-core: Parser rejects a generic call signature as the first member of an interface #420, [Bug]: tsrx-core: Parser rejects classes named after TypeScript contextual keywords (class global {},class abstract {}) #421, [Bug]: tsrx-core: Parser readsassert (…)on the line after an import as import assertions #423), fix(core): parse import attributes in import types (#422) #555 ([Bug]: tsrx-core: Parser rejects import attributes in import types (import("foo", { with: { type: "json" } })) #422), fix(core): collect type-check-level errors in collect mode instead of throwing (#415) #558 ([Bug]: tsrx-core: Parser throws on mistakes that TypeScript reports only as type-check diagnostics, even withcollect: true#415), fix(core): report '}' expected for a missing closing brace (#583) #590 ([Bug]: tsrx-core: A missing}is reported asUnexpected tokeninstead of'}' expected, and an unclosed directive body at the end of the input parses #583).Current state (this branch:
mainat4005d382plus this PR's commits)tests/prettier-known-failures.json)tests/prettier-overrides.js)await(…), 1 line-starting<after a callee.tsrxfilesprettier/standaloneDecisions so far
The user made these decisions during #409 and the parser PRs. Keep to them unless the user says otherwise.
typescriptparser for the same TSX. TSRX differs only where its syntax does. Differences from Prettier are bugs, even where@tsrx/prettier-plugindid something else on purpose.@if/@for/@switch/@try), or a@{ … }block used as a value, is wrapped in(…)where it's assigned, returned, thrown, or an arrow body, with its comments inside the parentheses. A@{ … }function or arrow body stays on its line. This matches@tsrx/prettier-pluginonmain. The one deliberate difference: a leading line comment before a directive in an assignment (const y = // c) prints the way Prettier prints a JSX element there.//and/* */). TSX reads them as text. They keep their line..tsrxfile is a strict-mode ES module and TSX-like. A lone arrow type parameter is written<T,>. Namespaced tags aren't supported. Prettier cases that aren't valid TSX, or not valid in a strict module, are left out at import.{...items}) parse, but are unsupported on every target. Core's analyzer reportstsrx-jsx-spread-child: fatal in a compile, collected in editor mode (fix(core): parse JSX spread children and report them as unsupported (#417) #495).<that starts a line is the next element (the TSRX rule), except where only type parameters can follow a name ([Bug]: tsrx-core: Parser rejects type parameters that start on the line after a declaration name #419).const { #x: x } = this) #424).@tsrx/prettier-plugin's tests aren't the expected output for this plugin. They are still being changed. Any comparison goes in its own place, and differences are review items (see work item 1).<script>bodies are formatted only when they hold JavaScript or TypeScript (notype,module, or a JS/TS type), with this plugin's own parser. Anything else is kept as written.@tsrx/prettier-plugin, or ships separately astsrx-prettier-plugin, is one of the last decisions. Until then, nothing else in the repository moves to it, and the old plugin stays the one that's used and published.@sveltejs/acorn-typescript, override that one method inTSRXPlugin(packages/tsrx/src/plugin.js) and file the issue upstream. Mark the override with// UPSTREAM(<repo>#<issue>): remove once a release includes the fix, and list it in the "Upstream workarounds" table below, so it can be found and removed later.collect: true#415). These are mistakes TypeScript only reports as diagnostics, such as a redeclared type,abstractoutside an abstract class, an ambient initializer, or optional-chaining assignment. Incollectandloosemode the parser records them and keeps parsing; a normal compile still throws. Inputs that only TypeScript's error recovery accepts (6 Prettier cases) are skipped with a reason, like proposal syntax.}is reported as'}' expected, like TypeScript, not as acorn's genericUnexpected token. This applies to every block, template and JavaScript alike.//comment between<and a tag name goes on its own indented line after<, as@tsrx/prettier-pluginprints it since fix(core): start an element at its<, and continue an element statement across a line break (#467, #496) #500. Prettier's own output (<// notewithdivon the next line) isn't valid TSX, and Prettier can't re-parse it. The exception is an element's direct child, which keeps<// note: there, a<followed by a line break is text (core's literal-<rule, soa < bworks in text), and the layout would turn the element into text.<and a tag name prints straight away in the form Prettier's second pass settles on,</* note */ div />. That's Prettier parity, and it's stable. The same goes for a closing tag (</ /* note */ div>), where Prettier's first format is unstable too.<that starts a line is an element, even after a callee (foofollowed by<string>(1)on the next line). This is what makes semicolon-less templates work (const label = "hi"followed by<string>{label}</string>). Prettier'stypescript/call/callee-comments.tsis skipped as a TSRX difference.@{ … }value follows Prettier's JSX layout, which is already the case.const y = // leadthen@if …keeps the comment after=. A comment on its own line after=goes inside the parentheses (const y = (/// lead/@if …).Remaining work
The order the user set: Phase 1 first, then the open parser issues (in progress as separate core PRs), then Phase 3. Phase 2 is on hold: the user doesn't want this plugin tested against
@tsrx/prettier-plugin's tests for now. Phase 1 is complete: every item is merged or in this PR, and there are no known failures. This PR can merge once the user is happy with it (it only touches the private package, so it needs no changeset); Phase 2 then continues in a new working PR that carries this plan over.Phase 1: parser fixes and formatting decisions
The parser fixes are separate PRs against
@tsrx/core, each from its own worktree, and can run in parallel where they touch different code. The formatting decisions land in this PR. After each parser PR merges, mergemaininto this PR, re-import, and refresh the known failures (see the runbook).staticbefore a line break becomes a field name, a miscompile), #420 (generic call signature as an interface's first member), #421 (class global {}), #423 (import "x"thenassert (…)on the next line). Each: override the acorn-typescript method (decision 13), file the upstream issue, and add tests.import("./a.json", { with: … })). OverridetsParseImportTypeto parse the options object intoTSImportType.options, and file the upstream issue.@tsrx/prettier-pluginprintsTSImportTypeitself, so it must learn to printoptionsin the same PR, or it would drop them. This plugin's adapter already keepsoptionsfor Prettier's printer; confirm it prints them.raise/raiseRecoverablethrough one allow-list of these messages. Handle the twounexpected()cases: passcheckPrivateFields: falsewhen collecting, and accept aconstwithout an initializer when collecting. A normal compile keeps throwing.'}' expectedfor a missing}(decision 15), for template and JavaScript blocks alike. It touches error reporting, like 1.3, so it goes after 1.3 or is coordinated with it. File the issue first.//comment before a tag name gets its own line), 17 (a block comment on its own line prints as</* note */ div />), 18 (skipcallee-comments.tswith its reason), and skip #415's 6 error-recovery inputs with their reason. Decision 19 needs no change: it already matches Prettier in both placements.Upstream workarounds (decision 13). Add a row when an override lands, and remove it when the upstream fix is released and the override is gone:
plugin.jstsParseModifier,tsParseModifiers(#551)tsParseInterfaceBody(#551)parseClassId(#551)parseMaybeImportAttributes(#551)tsParseImportType(#555)TSImportTypeoptions printed intsx_with_ts_locations(#555)optionsCHECKER_LEVEL_ERRORSallow-list throughraise/raiseRecoverable, andcanAwaitin namespaces (#558)All rows are live: #551, #555 and #558 are merged.
Where an open upstream issue or PR already covers a cause, the override references it instead of a new issue:
class global {},class abstract {}) #421 (contextual-keyword class names), [Bug]: tsrx-core: Parser rejects import attributes in import types (import("foo", { with: { type: "json" } })) #422 (import attributes in import types), and the optional binding-pattern parameter from [Bug]: tsrx-core: Parser throws on mistakes that TypeScript reports only as type-check diagnostics, even withcollect: true#415. Overrides for these mirror feat: remove lazy destructuring (RFC #106) #110's AST, so removing them later doesn't change the AST.collect: true#415's question for acorn-typescript's errors. acorn's errors in [Bug]: tsrx-core: Parser throws on mistakes that TypeScript reports only as type-check diagnostics, even withcollect: true#415 are ECMAScript early errors, where acorn is right, so nothing is filed with acorn.The adapter in this plugin has one workaround of its own: it wraps
export importin anExportNamedDeclarationfor sveltejs/acorn-typescript#114 (src/parse.js,TSImportEqualsDeclaration). The user's other open acorn-typescript items are #111 (tsrx #169), #112 with its fix #113 (tsrx #194; #421's override touches the sameparseClassId, so coordinate), and #116 (tsrx #342).Follow-up issues found during Phase 1
Filed, not part of Phase 1, and open unless noted:
raisecall; not filed upstream yet.import()(import("./a.js",)) #554: a trailing comma inimport()is rejected (fixed upstream by test: run the parser over the TypeScript compiler corpus sveltejs/acorn-typescript#110).}before a closing tag reads</as less-than and a regular expression, unlike TSX #586:</right after an expression (<p>{count</p>) is read as<plus a regular expression.importandexportinside a block, which TypeScript reports from its checker #587:import/exportinside a block throws in collect mode (TS1184/TS1232).constorvarwith no declarator and a barelet, which TypeScript reports from its checker #588: aconst/varwith no declarator, or a barelet, throws in collect mode (TS1123/TS1214).?in compiled and editor output #556: the printed TypeScript drops the?from an optional binding-pattern parameter.@tsrx/prettier-plugin: [Bug]: @tsrx/prettier-plugin: Formatter never breaks between the arguments ofimport(source, options)like Prettier #553: the arguments ofimport(source, options)never break the way Prettier breaks them.options) sveltejs/esrap#231 (TSImportTypeoptions).Known failures today
None. #551, #555 and #558 fixed every parser cause, and this PR skips the 7 cases TSRX reads differently on purpose (decision 18 and #415's error-recovery inputs). From here on, a new known failure means a regression or a new Prettier release.
Phase 2: compare with
@tsrx/prettier-plugin's tests (on hold)On hold by the user's decision: don't test this plugin against the old plugin's tests for now. When it resumes: Run the old plugin's test suite (
packages/prettier-plugin/src/index.test.js: 826 tests, input →format()→toBeWithNewline(expected)) against this plugin, and sort every difference into:tests/tsrx.test.js.@{ … }that is an element's only child (<div>@{…}</div>). List these for the user.How:
packages/tsrx-prettier-plugin/src/index.js, from a scratch copy or with a vitest alias. Don't change the old plugin or its tests.Phase 3: more TSRX tests
Write them from the language rules and Prettier's behavior, not from the old plugin's tests. Areas that aren't covered yet:
@forheads that break, with destructuring,indexandkey@elsebranches@{ … }inside JSX attributes and expression containers<style apply>variants and assigned themessemi: false,singleQuote,bracketSameLine,singleAttributePerLinefor TSRX syntaxOngoing: keeping up with Prettier
pnpm --filter tsrx-prettier-plugin import-prettier-tests, then refresh the known failures.src/jsx.js(copied from Prettier'sprintJsxElementInternalandprintJsxChildren) in step with Prettier.src/language-js/parse/postprocess: node shapes the printer expects can change between releases.Last: the release decision (the user decides)
Nothing moves to this plugin until the user is absolutely sure (decision 12). Phases 1–3 are what build that confidence. When the time comes, the user chooses between:
@tsrx/prettier-plugin: publish this plugin under that name.tsrx-prettier-plugin, next to or instead of the old one.Either way, these would need doing, so check each one with the user before touching it:
major).package.jsonand.prettierrc.changeset/config.json(the fixed group)packages/language-server/src/server.jspackages/tsrx-mcp(src/format.js,src/server.js,src/inspect.js, tests)website-tsrx(package.json,src/routes.ts,src/pages/getting-started.tsrx)prettier/standalone).Runbook
To check the repository's
.tsrxfiles (no errors, and a second format changes nothing), run this frompackages/tsrx-prettier-plugin:Conventions
mainand check for duplicates first. A finding with the same root cause as the current PR goes in its description instead.patchchangeset for@tsrx/core, and verified by comparing ASTs before and after over the repository's.tsrxfiles, the test-file sources, and the Prettier snapshot inputs.git stash:refs/stashis shared by every worktree and other sessions run in parallel. Use patch files or WIP commits.spawnSync(…, { timeout, killSignal: 'SIGKILL' })or aWorkerwithterminate(), sincetimeoutisn't installed. Use at most 4 workers, and isolate tests in a Worker or child process, because a vitest timeout can't stop a synchronous loop. Checkpsafterwards.mainneeds a review, and agents can't merge.git statusis clean and the local branch head matches the PR's last commit.@tsrx/prettier-pluginchanges need apatchchangeset (majoris rejected).Open questions for the user
None right now. The order of work is Phase 1, then Phases 2 and 3, and the release decision comes last. Upstream issues for the Phase 1 overrides are filed from the user's GitHub account, as part of each fix.
🤖 Generated with Claude Code
Note
Low Risk
Changes are limited to the private formatter package, are covered by Prettier import tests and new TSRX tests, and affect output formatting rather than runtime or security behavior.
Overview
Completes Phase 1 of the experimental
tsrx-prettier-plugin: README documents current parser/printer behavior and the test layout; Prettier parity for several edge cases; known Prettier import failures drop to zero (remaining mismatches are explicit skips).Parser (
parse.js) normalizes failures throughcreateParseError(1-basedloc.start, message shape like Prettier’s parsers).textWithoutCommentsis shared so@case{andexport importtoken positions ignore braces/importinside comments (#509).<style>/<script>bodies gettsrxRawTextwhen embedded formatting is off (#503).Printer (
printer.js) adds comment placement aligned withif/try/else:@if/@tryhook estreehandleComments;printBeforeBranch/@for@emptyhandling (#505);@catchcomments before@;printTagNameCommentsso//before a tag name is valid TSX (#504-style nested@{ … }treated as a statement, not a parenthesized value).embeddedLanguageFormatting: "off"prints style/script viaprintRawTextAsWritten.Tests: expanded
tsrx.test.js;prettier-known-failures.jsoncleared;prettier-overrides.jsskips TypeScript-only error-recovery cases, line-start<after a callee, and related cases.Reviewed by Cursor Bugbot for commit e847ab3. Bugbot is set up for automated code reviews on this repo. Configure here.