From 01ed68ac813f9064090babefb55be0c857c8b8d6 Mon Sep 17 00:00:00 2001 From: Yuji Sugiura <6259812+leaysgur@users.noreply.github.com> Date: Fri, 30 Oct 2026 17:45:37 +0900 Subject: [PATCH] docs(oxfmt,formatter_htmlish,formatter): clean up behavior comments (#28384) We do not need to note about Prettier internals. --- apps/oxfmt/src/core/embed/dispatcher.rs | 3 +-- apps/oxfmt/src/core/embed/jsdoc_fence.rs | 2 +- apps/oxfmt/test/api/embedded_languages.test.ts | 5 ++--- crates/oxc_formatter/src/embed_context.rs | 2 +- crates/oxc_formatter/src/formatter/context.rs | 2 +- crates/oxc_formatter/src/lib.rs | 2 +- .../oxc_formatter/src/parentheses/expression.rs | 2 +- crates/oxc_formatter/src/utils/string.rs | 2 +- crates/oxc_formatter_css/src/format.rs | 2 +- crates/oxc_formatter_htmlish/AGENTS.md | 2 +- crates/oxc_formatter_htmlish/src/format.rs | 2 +- .../oxc_formatter_htmlish/src/print/attribute.rs | 2 +- .../oxc_formatter_htmlish/src/print/children.rs | 6 +++--- .../oxc_formatter_htmlish/src/print/element.rs | 2 +- crates/oxc_formatter_htmlish/src/print/embed.rs | 8 ++++---- crates/oxc_formatter_htmlish/src/print/mod.rs | 2 +- crates/oxc_formatter_htmlish/src/print/text.rs | 6 +++--- .../src/tree/build/merge.rs | 4 ++-- .../oxc_formatter_htmlish/src/tree/build/mod.rs | 6 +++--- crates/oxc_formatter_htmlish/src/tree/display.rs | 4 ++-- crates/oxc_formatter_htmlish/src/tree/mod.rs | 16 ++++++++-------- 21 files changed, 40 insertions(+), 42 deletions(-) diff --git a/apps/oxfmt/src/core/embed/dispatcher.rs b/apps/oxfmt/src/core/embed/dispatcher.rs index 9fecdfddfc..a8f54f4c0d 100644 --- a/apps/oxfmt/src/core/embed/dispatcher.rs +++ b/apps/oxfmt/src/core/embed/dispatcher.rs @@ -342,8 +342,7 @@ pub fn build_dispatcher( dispatch_config.toml_options(), ), NativeLanguage::Html(variant) => { - // Every part is embedded in its parent (Prettier's `parentParser`), - // but a JSDoc code block, formatted on its own + // Every part is embedded in its parent, but a JSDoc code block, formatted on its own let embedded_in = if let Some(c) = request.parent_context_as::() { Some(HtmlishEmbeddedIn { diff --git a/apps/oxfmt/src/core/embed/jsdoc_fence.rs b/apps/oxfmt/src/core/embed/jsdoc_fence.rs index ac7a30a240..f0db24c937 100644 --- a/apps/oxfmt/src/core/embed/jsdoc_fence.rs +++ b/apps/oxfmt/src/core/embed/jsdoc_fence.rs @@ -17,7 +17,7 @@ use oxc_formatter_core::{ use super::dispatcher::ResolvedDispatchConfig; /// Parent→child context for a JSDoc fenced code block: -/// a part formatted on its own, as Prettier formats it (`prettier.format`, no `parentParser`), +/// a part formatted on its own, as a file is, /// where every other dispatched part is embedded in its parent. pub struct XxxInJsdocFence; diff --git a/apps/oxfmt/test/api/embedded_languages.test.ts b/apps/oxfmt/test/api/embedded_languages.test.ts index dbcf8270f5..acec472a04 100644 --- a/apps/oxfmt/test/api/embedded_languages.test.ts +++ b/apps/oxfmt/test/api/embedded_languages.test.ts @@ -284,9 +284,8 @@ describe("Embedded languages", () => { `); }); - // (css-in-html)-in-js: For now, HTML is handled by Prettier, so CSS is also handled by Prettier too. - // The CSS `Doc` carries a trailing space after `prop: ` that only materializes when the value fits flat; - // when the value breaks, it must not leak (the Doc→IR conversion maps it to a pending space, dropped at the break). + // (css-in-html)-in-js: the space after `prop:` belongs to a value that fits on the line, + // so a value that breaks must not leave it at the end of the line. it("should not leak a trailing space when a css-in-html declaration value breaks", async () => { const input = `\ export const BaseStyles = html\` diff --git a/crates/oxc_formatter/src/embed_context.rs b/crates/oxc_formatter/src/embed_context.rs index 60ca66b0d4..9e94dc7acc 100644 --- a/crates/oxc_formatter/src/embed_context.rs +++ b/crates/oxc_formatter/src/embed_context.rs @@ -39,7 +39,7 @@ pub const HTML_PLACEHOLDER_SUFFIX: &str = "_IN_JS"; /// `name` is an html-in-js placeholder, of any depth. /// One in a `