jscodeshift
jscodeshift is a toolkit for creating and running codemods across JavaScript and TypeScript files.
What jscodeshift is
jscodeshift is a toolkit for creating and running codemods across JavaScript and TypeScript files. A codemod parses code into an abstract syntax tree, changes selected nodes, and turns the result back into source code. The runner applies a transform file by file and reports how many files were unchanged. From the command line, you can supply a local transform, a transform URL, or file paths through standard input. Parser choices include Babel, Babylon, Flow, TypeScript, and TSX, with Babel as the default. The CLI can limit child processes, select file extensions, and exclude files with ignore patterns or configuration files. Dry-run mode previews a transformation without changing files. Its API supports traversing, filtering, finding, replacing, inserting, removing, and renaming syntax-tree nodes, with optional formatting when generating output. jscodeshift wraps recast, which aims to retain the original code style. It also includes Jest and Jasmine utilities for fixture-based or inline transform tests. The toolkit is free and available for Linux, macOS, Windows, and self-hosted environments.
Good
- Dry-run previews changes without modifying files.
- Supports Babel, Babylon, Flow, TypeScript, and TSX parsing.
- Can select extensions and exclude files.
- Includes Jest and Jasmine transform-testing utilities.
Watch out
- The CLI defaults to Babel parsing.
- Requires a local transform, URL, or file paths to run.
Who it suits
It suits developers who need to detect and transform JavaScript, TypeScript, or Flow code across a project. Its CLI options and transform-testing utilities are useful for batch refactoring workflows.
Verdict
jscodeshift provides project-level AST transformations with controls for file selection, parsing, and previewing changes. Developers can test transforms with its included utilities before applying them to source files.
The facts
Each one read from jscodeshift's own pages, with the date it was checked.
What it does
- API
- The API includes traversal, filtering, and transformation methods for AST nodes.checked 5 Oct 2026
- CLI
- The command-line interface runs codemods from a local transform file, a transform URL, or a list of paths read from standard input.checked 4 Oct 2026
- Code preservation
- The toolkit wraps recast, which attempts to preserve the original code style when generating transformed source.checked 5 Oct 2026
- Code transformations
- The API provides methods to find, filter, replace, insert, remove, and rename syntax-tree nodes.checked 4 Oct 2026
- Distribution
- The documentation directs users to install jscodeshift from npm with `npm install -g jscodeshift`.checked 4 Oct 2026
- Dry run
- The CLI supports dry runs that show the effects of a codemod without changing files.checked 5 Oct 2026
- Editor integration
- The project README links instructions for configuring VS Code to debug codemods.checked 4 Oct 2026
- File selection
- The CLI supports selecting file extensions and excluding files with ignore patterns or configuration files.checked 4 Oct 2026
- Formatting
- The API can convert a transformed syntax tree back to source code with optional formatting settings.checked 4 Oct 2026
- Install
- The documentation instructs users to install the runner globally with npm install -g jscodeshift.checked 5 Oct 2026
- Integration
- The project README documents a VS Code debugger setup for debugging codemods.checked 5 Oct 2026
- Intended users
- The documentation describes jscodeshift as a tool for developers who build codemods to detect and transform JavaScript or TypeScript code.checked 4 Oct 2026
- License
- The project is distributed under the MIT License.checked 5 Oct 2026
- Parallel processing
- The CLI can start up to a specified number of child processes to process source files; its default is max(all - 1, 1).checked 5 Oct 2026
- Parser options
- The CLI documents babel, babylon, flow, ts, and tsx as parser options.checked 5 Oct 2026
- Parsers
- The CLI lists babel, babylon, flow, ts, and tsx as parser options, with babel as the default.checked 4 Oct 2026
- Purpose
- jscodeshift is a toolkit for building and running codemods over multiple JavaScript or TypeScript files.checked 5 Oct 2026
- Runner
- Its runner executes a transform for each input file and summarizes how many files were transformed.checked 5 Oct 2026
- Support channel
- The package metadata points users to GitHub issues for bug reports.checked 5 Oct 2026
- Testing
- The project README says jscodeshift includes a utility for unit testing codemods with Jest.checked 5 Oct 2026
- Transform URL
- The CLI can take a URL as the transform file path.checked 5 Oct 2026
- Workflow
- A codemod parses code into an AST, transforms the AST, and generates source code from it.checked 5 Oct 2026
Where it runs
- Recast wrapper
- The toolkit wraps recast, which aims to preserve the original code style when transforming an abstract syntax tree.checked 4 Oct 2026
Alternatives to jscodeshift
- 1

Sourcery
Free planWebAPIExtensionLinux7.9From $12 a month - 2

Moderne
WebAPILinuxmacOS7.3From $2,000 a month - 3

ast-grep
Free planWebAPIExtensionLinux7.0Free plan - 4

ReSharper
Free planExtensionLinuxmacOSWindows6.8From $389 a year - 5
jSparrow
LinuxmacOSWindows6.4From $1,325 a year - 6

CodeRush
Free planExtensionLinuxmacOSWindows6.3Free plan
