Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Ember
  3. jscodeshift

jscodeshift

MITJavaScriptv17.3.0

A toolkit for running codemods over multiple JavaScript or TypeScript files using AST transformations.

Visit WebsiteGitHubGitHub
10.0k stars495 forks0 contributors

What is jscodeshift?

jscodeshift is a toolkit for running codemods (code modification scripts) across multiple JavaScript or TypeScript files. It provides a CLI runner and a JavaScript API to apply transformations, making large-scale codebase refactoring and upgrades efficient and consistent.

Target Audience

JavaScript and TypeScript developers, library maintainers, and teams needing to perform automated, consistent code transformations across entire projects or codebases.

Value Proposition

Developers choose jscodeshift for its jQuery-like API for AST manipulation, which simplifies writing complex codemods, and its ability to preserve original code formatting while supporting multiple parsers like Babel, Flow, and TypeScript.

Overview

A JavaScript codemod toolkit.

Use Cases

Best For

  • Automated large-scale codebase refactoring, such as updating React APIs across a project.
  • Upgrading JavaScript syntax to newer ECMAScript versions consistently across many files.
  • Applying custom code style or linting fixes programmatically across a codebase.
  • Migrating code from one library or framework to another (e.g., replacing deprecated APIs).
  • Writing and unit testing codemods with Jest integration and snapshot testing.
  • Transforming code while preserving original formatting and comments using recast.

Not Ideal For

  • Projects requiring real-time or interactive code changes with manual review
  • Codebases in languages other than JavaScript or TypeScript
  • Quick, one-off edits where writing a full codemod script outweighs the benefit
  • Teams lacking AST manipulation experience who need simpler tools like regex search-and-replace

Pros & Cons

Pros

Fluent AST API

Offers a jQuery-like interface for navigating and modifying ASTs, making complex transformations more readable and maintainable, as shown in the example using .findVariableDeclarators().

Preserves Code Style

Uses recast under the hood to retain original formatting and comments during transformations, reducing noise in diffs and maintaining code consistency.

Multi-Parser Support

Supports Babel, Flow, TypeScript, and custom parsers, allowing it to handle diverse codebases and modern JavaScript features seamlessly.

Built-in Testing Utilities

Includes helpers like defineTest and defineInlineTest for unit testing transforms with Jest and snapshot testing, streamlining the development of reliable codemods.

Cons

Steep Learning Curve

Requires deep understanding of ASTs and the jscodeshift API, which can be a barrier for developers unfamiliar with abstract syntax trees or complex code manipulation.

Limited Language Support

Only works with JavaScript and TypeScript files, making it unsuitable for projects with mixed or non-JS codebases without additional tooling.

Debugging Complexity

Debugging transforms can be challenging, especially with asynchronous issues or intricate AST changes, though the README provides VSCode setup guidance.

Frequently Asked Questions

Quick Stats

Stars10,025
Forks495
Contributors0
Open Issues122
Last commit3 days ago
CreatedSince 2015

Tags

#codemod#cli-tool#ast-transformation#automated-refactoring#typescript#javascript#recast#code-refactoring#babel

Built With

J
JavaScript
R
Recast
N
Node.js

Links & Resources

Website

Included in

Ember202
Auto-fetched 12 hours ago

Related Projects

ember-template-recastember-template-recast

Non-destructive template transformer.

Stars42
Forks38
Last commit1 year ago
ember-ast-helpersember-ast-helpers

Utility belt to level-up your Ember AST transforms

Stars40
Forks5
Last commit3 years ago
dyfactordyfactor

A platform for running codemods based on runtime information

Stars8
Forks5
Last commit4 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub