Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lingui/codemods

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lingui/codemods

@lingui codemod scripts

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Linguijs Codemods

This repository contains a collection of codemod scripts for use with JSCodeshift that help update Lingui APIs.


Usage

npx @lingui/codemods <transform> <path> [...options]

  • transform - name of transform, see available transforms below.
  • path - files or directory to transform
  • use the --dry option for a dry-run
  • use --print to print the output for comparison
  • use --remove-unused-imports to remove unused imports once finished the codemod

This will start an interactive wizard, and then run the specified transform.

Included Transforms

v2-to-v3

Converts some outdated standards from lingui version 2.x.x to new features and best practices introduced in lingui version 3.x.x

npx @lingui/codemods v2-to-v3 <path>
split-macro-imports

Converts @lingui/macro imports to @lingui/core/macro and @lingui/react/macro.

npx @lingui/codemods split-macro-imports <path>

Visit the Migration guide from 4.x to 5.x for more information.

jscodeshift options

To pass more options directly to jscodeshift, use --jscodeshift="...". For example:

npx @lingui/codemods --jscodeshift="--run-in-band --verbose=2"

See all available options here.

Recast Options

Options to recast's printer can be provided through jscodeshift's printOptions command line argument

npx @lingui/codemods <transform> <path> --jscodeshift="--printOptions='{\"quote\":\"double\"}'"

Usage without params

A CLI is built-in to help you migrate your codebase, will ask you some questions:

➜  project git:(master) npx @lingui/codemods
? On which files or directory should the codemods be applied? for ex: ./src
? Which dialect of JavaScript do you use? for ex: JavaScript | Typescript | JavaScript with Flow
? Which transform would you like to apply? for ex: `v2-to-v3`

License

@lingui/codemods is MIT licensed.

Keywords

FAQs

Package last updated on 05 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc