jscodeshift
jscodeshift.com
What it is
jscodeshift is a free toolkit for developers who build and run codemods across JavaScript, TypeScript, or Flow projects. A codemod parses source into an abstract syntax tree, changes that tree, and generates source code. The runner applies a transform to each file and reports files that were not transformed. Its command line accepts a local transform, a URL, or paths from standard input. Parser choices include Babel, Babylon, Flow, TypeScript, and TSX, with Babel as the default. Users can set child-process limits, choose extensions, exclude paths with ignore patterns or configuration files, and preview changes in dry-run mode. The API supports traversal, filtering, finding, replacing, inserting, removing, and renaming syntax-tree nodes, with optional formatting during output. jscodeshift wraps recast to help preserve source style. Jest and Jasmine utilities support fixture or inline tests, and VS Code debugging guidance is documented. It runs on Linux, macOS, Windows, or self-hosted environments under an MIT license.
Spec sheet
- Purpose
- jscodeshift is a toolkit for building and running codemods over multiple JavaScript or TypeScript files.Read 5 Oct 2026 · jscodeshift.com
- Intended users
- The documentation describes jscodeshift as a tool for developers who build codemods to detect and transform JavaScript or TypeScript code.Read 4 Oct 2026 · jscodeshift.com
- API
- The API includes traversal, filtering, and transformation methods for AST nodes.Read 5 Oct 2026 · jscodeshift.com
- License
- The project is distributed under the MIT License.Read 5 Oct 2026 · github.com
- CLI
- The command-line interface runs codemods from a local transform file, a transform URL, or a list of paths read from standard input.Read 4 Oct 2026 · jscodeshift.com
- Code preservation
- The toolkit wraps recast, which attempts to preserve the original code style when generating transformed source.Read 5 Oct 2026 · jscodeshift.com
- Code transformations
- The API provides methods to find, filter, replace, insert, remove, and rename syntax-tree nodes.Read 4 Oct 2026 · jscodeshift.com
- Distribution
- The documentation directs users to install jscodeshift from npm with `npm install -g jscodeshift`.Read 4 Oct 2026 · jscodeshift.com
- Dry run
- The CLI supports dry runs that show the effects of a codemod without changing files.Read 5 Oct 2026 · jscodeshift.com
- Editor integration
- The project README links instructions for configuring VS Code to debug codemods.Read 4 Oct 2026 · github.com
- File selection
- The CLI supports selecting file extensions and excluding files with ignore patterns or configuration files.Read 4 Oct 2026 · jscodeshift.com
- Formatting
- The API can convert a transformed syntax tree back to source code with optional formatting settings.Read 4 Oct 2026 · jscodeshift.com
- Install
- The documentation instructs users to install the runner globally with npm install -g jscodeshift.Read 5 Oct 2026 · jscodeshift.com
- Integration
- The project README documents a VS Code debugger setup for debugging codemods.Read 5 Oct 2026 · github.com
- 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).Read 5 Oct 2026 · jscodeshift.com
- Parser options
- The CLI documents babel, babylon, flow, ts, and tsx as parser options.Read 5 Oct 2026 · jscodeshift.com
- Parsers
- The CLI lists babel, babylon, flow, ts, and tsx as parser options, with babel as the default.Read 4 Oct 2026 · jscodeshift.com
- Recast wrapper
- The toolkit wraps recast, which aims to preserve the original code style when transforming an abstract syntax tree.Read 4 Oct 2026 · jscodeshift.com
- Runner
- Its runner executes a transform for each input file and summarizes how many files were transformed.Read 5 Oct 2026 · jscodeshift.com
- Support channel
- The package metadata points users to GitHub issues for bug reports.Read 5 Oct 2026 · github.com
- Testing
- The project README says jscodeshift includes a utility for unit testing codemods with Jest.Read 5 Oct 2026 · github.com
- Transform URL
- The CLI can take a URL as the transform file path.Read 5 Oct 2026 · jscodeshift.com
- Workflow
- A codemod parses code into an AST, transforms the AST, and generates source code from it.Read 5 Oct 2026 · jscodeshift.com
Strong points and limits
Strong points
- Free plan with no trial requirement
- Dry runs preview changes safely
- Five documented parser options
- Supports parallel child processes
- Includes Jest and Jasmine test utilities
Limits
- Requires command-line installation through npm
- Transforms target JavaScript-family languages only
- Bug reports go through GitHub issues
Who it suits
jscodeshift is for developers performing batch refactoring or AST-based analysis on JavaScript, TypeScript, or Flow code. It suits project-level codemod workflows on desktop or self-hosted systems.
Verdict
jscodeshift provides a focused, scriptable workflow for AST-based code transformations. Its parser choices, dry runs, filtering, and testing utilities support controlled project refactoring.
Where Specifiction places it
- Code Refactoring Tools#13 of 227.7