Skip to content

fix(macro): Ignore JSX comments when generating message ids#2434

Merged
andrii-bodnar merged 1 commit intolingui:mainfrom
maisano-patreon:jsx-empty-expression-bugfix
Feb 11, 2026
Merged

fix(macro): Ignore JSX comments when generating message ids#2434
andrii-bodnar merged 1 commit intolingui:mainfrom
maisano-patreon:jsx-empty-expression-bugfix

Conversation

@maisano-patreon
Copy link
Contributor

@maisano-patreon maisano-patreon commented Feb 5, 2026

Description

JSX comments like {/* @ts-expect-error */} were consuming expression indices during message extraction, causing different hashes when comments were added/removed. I noticed this in a production build when compiling a Next.js application with @lingui/swc-plugin (which does not have this bug).

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Examples update

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Feb 5, 2026

@maisano-patreon is attempting to deploy a commit to the Crowdin Team on Vercel.

A member of the Team first needs to authorize it.

@timofei-iatsenko timofei-iatsenko changed the title Ignore JSX comments when generating message ids fix(macro): Ignore JSX comments when generating message ids Feb 5, 2026
@timofei-iatsenko
Copy link
Collaborator

@maisano-patreon thanks for fix, interesting why that wasn't reported before.

note for myself - need to create the same test case in SWC repo.

@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.21%. Comparing base (6bb8983) to head (a368cc4).
⚠️ Report is 257 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2434      +/-   ##
==========================================
+ Coverage   77.05%   81.21%   +4.16%     
==========================================
  Files          84      104      +20     
  Lines        2157     2720     +563     
  Branches      555      725     +170     
==========================================
+ Hits         1662     2209     +547     
+ Misses        382      364      -18     
- Partials      113      147      +34     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@timofei-iatsenko
Copy link
Collaborator

@andrii-bodnar i'm thinking of merging this to main and cherry-picking to the next, wdyt?

@andrii-bodnar
Copy link
Contributor

@timofei-iatsenko I agree, it would be nice to have this fix released in v5

@vercel
Copy link

vercel bot commented Feb 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
js-lingui Ready Ready Preview Feb 5, 2026 10:14am

Request Review

@maisano-patreon
Copy link
Contributor Author

Hey folks – any plans to merge this?

Copy link
Contributor

@andrii-bodnar andrii-bodnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maisano-patreon thanks for the contribution! My apologies for the delay 🙏

@andrii-bodnar andrii-bodnar merged commit c09deaa into lingui:main Feb 11, 2026
11 of 13 checks passed
@andrii-bodnar
Copy link
Contributor

@maisano-patreon available in v5.9.1

@maisano-patreon
Copy link
Contributor Author

@andrii-bodnar Thanks! Happy to contribute 🙂

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.

3 participants