Skip to content

Fix comments after the opening JSX bracket - #20178

Open
charan-rathore wants to merge 6 commits into
prettier:mainfrom
charan-rathore:fix-jsx-opening-comment-20168
Open

charan-rathore wants to merge 6 commits into
prettier:mainfrom
charan-rathore:fix-jsx-opening-comment-20168

Conversation

@charan-rathore

Copy link
Copy Markdown

Description

A line comment between < and a JSX tag name was printed right against the bracket, producing <// c. That output could not be parsed on the next format. Keep the comment on a new, indented line so the output remains valid and stable. Fixes #20168.

Instinct assisted with the change and tests.

Checklist

  • I've added tests to confirm my change works.
  • (If changing the API or CLI) I've documented the changes I've made (in the docs/ directory). (Not applicable: no API/CLI change.)
  • (If the change is user-facing) I've added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md. (Rename 20168.md and heading to the PR number when known.)
  • I've read the contributing guidelines. (Charan should check this himself.)
  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting. (Leave unchecked until Charan personally reviews and can attest.)

Add handling for leading line comments in JSX element names.
Add Jest snapshot for line-comment JSX formatting test.
This change ensures that line comments between the opening JSX bracket and the tag name are preserved on a new line, improving parsing and formatting.
@agentscanapp

agentscanapp Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Automation signals

Activity patterns show signs of automation.

View full analysis →

Report this account →

Evidence
  • Closed PRs across many repositories: 53 PRs were closed across 29 repositories in 8d, with spike days of 14 and 13 closures each.
  • High comment frequency across repos: 25 comments to 12 different repos in 1 minute

Last 5 PRs:

This is an automated analysis by AgentScan

Updated changelog entry for issue prettier#20178.
@netlify

netlify Bot commented Sep 29, 2026

Copy link
Copy Markdown

✅ Deploy Preview for prettier ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 712c26a
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/6abb530bd72d8f0008116e6d
😎 Deploy Preview https://deploy-preview-20178--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 29, 2026

Copy link
Copy Markdown

✅ Deploy Preview for prettier ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit c4cf8d4
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/6abb5323914b1e0009a888d3
😎 Deploy Preview https://deploy-preview-20178--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@charan-rathore

Copy link
Copy Markdown
Author

Sorry, this was closed by mistake, reopening.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSX: a line comment between < and the tag name prints <// c, which doesn't parse

1 participant