jscodeshift
jscodeshift.com
2
Leaving SiteNav
External Link Disclaimer
You are about to visit jscodeshift.com. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
jscodeshift is an open-source toolkit developed by Meta for running codemods, automated code transformations that modify JavaScript and TypeScript source files at scale using abstract syntax tree manipulation. Hosted on GitHub at facebook slash jscodeshift with over 8,500 stars, the tool wraps the recast AST parser and ast-types library to provide a jQuery-like fluent API for traversing, querying, and modifying AST nodes without losing source formatting or comments. Codemods written as JavaScript functions receive a file object containing the parsed AST and a jscodeshift helper object, then return the transformed AST which the runner writes back to disk. The toolkit processes thousands of files in parallel using worker threads, supports custom parsers for Babel, TypeScript, Flow, and Vue single-file components, and integrates with git for dry-run and diff preview before applying changes. Major real-world migrations include Facebook converting millions of lines of internal code across React API changes, the Jest team automating test runner upgrades, the React Native community migrating from PropTypes to TypeScript, and numerous open-source projects automating dependency upgrades. The tool supports find-and-replace operations, API renaming, deprecated feature removal, import reorganization, and bulk pattern refactoring. Extensions include ts-migrate for adding TypeScript types to JavaScript codebases, and the codemod community registry at codemod.com for sharing transformations. The CLI accepts glob patterns, file extensions, and transformation modules, outputting statistics on files changed, errors encountered, and time elapsed.
Statistics
2
Views
0
Clicks
0
Like
0
Dislike