Aalexbit-codemod

lingui-macro-split

Migrate from deprecated @lingui/macro to split @lingui/react/macro and @lingui/core/macro packages

linguii18ninternationalizationmigrationmacroreact
Public
0 executions
0 stars
How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

lingui-macro-split

Migrate from deprecated @lingui/macro to split @lingui/react/macro and @lingui/core/macro packages

Usage

This codemod transforms TypeScript/JavaScript code by splitting imports from the deprecated @lingui/macro package into the new split packages:

  • React macros (Trans, Plural, Select, SelectOrdinal, I18n, Date, Number, Time, RelativeTime) → @lingui/react/macro
  • Core macros (t, msg, plural, select, selectOrdinal, i18n, date, number, time, relativeTime) → @lingui/core/macro
  • Other imports remain with @lingui/macro (for now)

Example

Before:

typescript

After:

typescript
Before

This is one example from the codemod's test cases. The codemod may handle many more cases.

Ready to contribute?

Build your own codemod and share it with the community.