jscodeshift
jscodeshift.com
- Free plan
- Windows
- macOS
- Linux
- Self-hosted
What jscodeshift is
jscodeshift is a toolkit for building and running codemods across JavaScript, TypeScript, and Flow code. A codemod parses code into an abstract syntax tree, transforms it, and generates source again. The runner applies a transform to selected files and reports how many were not changed. Its command-line interface can use a local transform file, a transform URL, or paths read from standard input. Parser options include Babel, Babylon, Flow, TypeScript, and TSX, with Babel as the default. Developers can set a child-process limit, select extensions, and exclude files with ignore patterns or configuration files. Dry-run mode previews the effect without changing files. The API supports traversal and filtering, along with finding, replacing, inserting, removing, and renaming syntax-tree nodes; source generation can use optional formatting settings. jscodeshift wraps recast, which aims to retain original code style. The project includes Jest and Jasmine utilities for transform tests, plus VS Code debugging instructions. It is free and runs on Linux, macOS, Windows, or self-hosted environments.
Who it suits
jscodeshift suits developers who need to detect and transform JavaScript, TypeScript, or Flow code across a project. Its dry-run and test utilities are useful parts of a codemod workflow.
Good to know, and what to watch
- Processes codemods across multiple files
- Dry runs preview changes without modifying files
- Supports Babel, Flow, TypeScript, and TSX parsers
- Includes Jest and Jasmine transform testing utilities
- Requires command-line and AST-based workflow familiarity
- The documented global install uses npm
The verdict
jscodeshift provides a project-level workflow for AST-based code transformations, with file selection, dry runs, and testing utilities. It is geared toward developers comfortable building codemods rather than a general-purpose code editor.
What the maker publishes
- API
- The API includes traversal, filtering, and transformation methods for AST nodes. source
- CLI
- The command-line interface runs codemods from a local transform file, a transform URL, or a list of paths read from standard input. source
- Code preservation
- The toolkit wraps recast, which attempts to preserve the original code style when generating transformed source. source
- Code transformations
- The API provides methods to find, filter, replace, insert, remove, and rename syntax-tree nodes. source
- Distribution
- The documentation directs users to install jscodeshift from npm with `npm install -g jscodeshift`. source
- Dry run
- The CLI's dry-run option previews the effect of a codemod without changing files. source
- Dry run
- The CLI supports dry runs that show the effects of a codemod without changing files. source
- Editor integration
- The project README links instructions for configuring VS Code to debug codemods. source
- File selection
- The CLI supports selecting file extensions and excluding files with ignore patterns or configuration files. source
- Formatting
- The API can convert a transformed syntax tree back to source code with optional formatting settings. source
- Install
- The documentation instructs users to install the runner globally with npm install -g jscodeshift. source
- Integration
- The project README documents a VS Code debugger setup for debugging codemods. source
- Intended users
- The documentation describes jscodeshift as a tool for developers who build codemods to detect and transform JavaScript or TypeScript code. source
- License
- The GitHub repository lists an MIT license. source
- License
- The project is distributed under the MIT License. source
- Parallel processing
- The CLI can start up to a specified number of child processes to process source files. source
- 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). source
- Parser options
- The CLI documents babel, babylon, flow, ts, and tsx as parser options. source
- Parsers
- The CLI lists babel, babylon, flow, ts, and tsx as parser options, with babel as the default. source
- Purpose
- jscodeshift is a toolkit for building and running codemods over multiple JavaScript or TypeScript files. source
- Purpose
- jscodeshift is a toolkit for building and running codemods over multiple JavaScript or TypeScript files. source
- Recast wrapper
- The toolkit wraps recast, which aims to preserve the original code style when transforming an abstract syntax tree. source
- Runner
- Its runner executes a supplied transform on each file and summarizes how many files were not transformed. source
- Runner
- Its runner executes a transform for each input file and summarizes how many files were transformed. source
Checked against the maker's pages on 5 Oct 2026.