Freedom251 › Code Refactoring Tools
jscodeshift

What jscodeshift is
jscodeshift is a free toolkit for developers who build and run codemods across JavaScript, TypeScript or Flow code. A codemod parses source into an abstract syntax tree, transforms it and generates source code. The runner applies a supplied transform to each file and summarizes files that were not changed. Its command-line interface accepts a transform from a local file or URL, or paths from standard input. Parser options include Babel, Babylon, Flow, TypeScript and TSX, with Babel as the default. Users can limit child processes, select file extensions and exclude files through ignore patterns or configuration files. Dry-run mode previews a transform without changing files. The API supports traversing, finding, filtering, replacing, inserting, removing and renaming syntax-tree nodes, with optional formatting when generating source. jscodeshift wraps recast, which aims to preserve the original code style. The project includes Jest and Jasmine utilities for fixture-based or inline tests, plus instructions for configuring VS Code to debug codemods. Documentation directs users to install it globally through npm; the repository lists an MIT license.
Who it suits
It suits developers building project-wide transformations for JavaScript, TypeScript or Flow code. The CLI and API offer options for selecting files, previewing changes and testing transforms.
What it does well
- Runs codemods across multiple files.
- Dry-run previews changes without modifying files.
- Offers Babel, Babylon, Flow, TypeScript and TSX parsers.
- Includes Jest and Jasmine transform-testing utilities.
- MIT-licensed and free.
What to know first
- Requires a local installation through npm.
- Babel is the default parser, so other syntax may need selection.
- It is a developer toolkit for code transformations.
Getting started
- Install the runner globally with `npm install -g jscodeshift`.
- Create or obtain a transform file, or provide a transform URL.
- Choose a parser option for the source files; Babel is the default.
- Select paths directly or provide a list of paths through standard input.
- Use dry-run mode to preview the transform before changing files.
Verdict
jscodeshift combines a multi-file runner with AST transformation methods, dry runs and test utilities. It is a practical fit for developers automating code changes across a project, provided they are comfortable working with codemods and the command line.
Questions
Does jscodeshift cost anything?
No. It is free, with a free plan and no free trial.
Which languages can it handle?
Its supported languages are JavaScript, TypeScript, and Flow. Parser options include Babel, Babylon, Flow, TypeScript, and TSX, with Babel as the default.
Which operating systems does it support?
Its listed platforms are Linux, macOS, Windows, and self-hosted environments.
How do I install it?
The documentation instructs users to install the runner globally with `npm install -g jscodeshift`.
Is jscodeshift open source?
The GitHub repository lists an MIT license.
Where can I report a bug?
The package metadata points users to GitHub issues for bug reports.
Facts from jscodeshift's own pages
- API
- The API includes traversal, filtering, and transformation methods for AST nodes. · jscodeshift.com, 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. · jscodeshift.com, 4 Oct 2026
- Code preservation
- The toolkit wraps recast, which attempts to preserve the original code style when generating transformed source. · jscodeshift.com, 5 Oct 2026
- Code transformations
- The API provides methods to find, filter, replace, insert, remove, and rename syntax-tree nodes. · jscodeshift.com, 4 Oct 2026
- Distribution
- The documentation directs users to install jscodeshift from npm with `npm install -g jscodeshift`. · jscodeshift.com, 4 Oct 2026
- Dry run
- The CLI supports dry runs that show the effects of a codemod without changing files. · jscodeshift.com, 5 Oct 2026
- Editor integration
- The project README links instructions for configuring VS Code to debug codemods. · github.com, 4 Oct 2026
- File selection
- The CLI supports selecting file extensions and excluding files with ignore patterns or configuration files. · jscodeshift.com, 4 Oct 2026
- Formatting
- The API can convert a transformed syntax tree back to source code with optional formatting settings. · jscodeshift.com, 4 Oct 2026
- Install
- The documentation instructs users to install the runner globally with npm install -g jscodeshift. · jscodeshift.com, 5 Oct 2026
- Integration
- The project README documents a VS Code debugger setup for debugging codemods. · github.com, 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. · jscodeshift.com, 4 Oct 2026
- License
- The project is distributed under the MIT License. · github.com, 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). · jscodeshift.com, 5 Oct 2026
- Parser options
- The CLI documents babel, babylon, flow, ts, and tsx as parser options. · jscodeshift.com, 5 Oct 2026
- Parsers
- The CLI lists babel, babylon, flow, ts, and tsx as parser options, with babel as the default. · jscodeshift.com, 4 Oct 2026
- Purpose
- jscodeshift is a toolkit for building and running codemods over multiple JavaScript or TypeScript files. · jscodeshift.com, 5 Oct 2026
- Recast wrapper
- The toolkit wraps recast, which aims to preserve the original code style when transforming an abstract syntax tree. · jscodeshift.com, 4 Oct 2026
- Runner
- Its runner executes a transform for each input file and summarizes how many files were transformed. · jscodeshift.com, 5 Oct 2026
- Support channel
- The package metadata points users to GitHub issues for bug reports. · github.com, 5 Oct 2026
- Testing
- The project README says jscodeshift includes a utility for unit testing codemods with Jest. · github.com, 5 Oct 2026
- Transform URL
- The CLI can take a URL as the transform file path. · jscodeshift.com, 5 Oct 2026
- Workflow
- A codemod parses code into an AST, transforms the AST, and generates source code from it. · jscodeshift.com, 5 Oct 2026
Where jscodeshift stands on Freedom251
- Code Refactoring Tools#8 of 22