Skip to content

fix(fmt): preserve unsupported ambient module import attributes - #643

Merged
chenjiahan merged 1 commit into
mainfrom
chenjiahan/fix-fmt-ambient-attributes
Nov 16, 2026
Merged

chenjiahan merged 1 commit into
mainfrom
chenjiahan/fix-fmt-ambient-attributes

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Motivation

SWC accepts ambient module import attributes, but Prettier's ESTree printer silently removes them, changing the declaration's meaning.

Fixes #638. Upstream support: prettier/prettier#20531.

Changes

Reject these declarations before printing until Prettier supports them. Standalone files report an error without being rewritten; Markdown and MDX code blocks retain their original text through Prettier's embedded formatting fallback.

Add two focused tests for the standalone-file error and MDX preservation behavior.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T03:09:19.784067Z 5f70661 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying rstack-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5f70661
Status: ✅  Deploy successful!
Preview URL: https://5265f656.rstack-cli.pages.dev
Branch Preview URL: https://chenjiahan-fix-fmt-ambient-a.rstack-cli.pages.dev

View logs

@chenjiahan
chenjiahan merged commit 2450a17 into main Nov 16, 2026
5 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/fix-fmt-ambient-attributes branch November 16, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(fmt): ambient module import attributes are silently removed in 0.9.1

1 participant