Skip to main content



Code that is written with the sole intent of transforming other code. An example would be a piece of code that takes a normal function, and rewrites it to be an arrow function.

– Reference


A transform is simply a javascript function which serves as the entry-point for your codemod.

For example:

export default function transform(file, { jscodeshift: j }, options) {
//... codemod goes here


A motion (aka migration) is what we call specific actions performed within a codemod. Put simply, javascript functions that are responsible for a single action within a codemod.

For more information see: Authoring


An abstract syntax tree (AST), is a tree representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code.

– Wiki: Abstract syntax tree


jscodeshift is the underlying library used by CodeshiftCommunity.

  • Provides both a CLI for running transforms and a jQuery-like API for manipulating ASTs
  • AST transformations are performed using a wrapper around recast.
  • The AST is implemented in ast-types, which is itself based on esprima


recast is the underlying library used by jscodeshift to parse, transform and output files as ASTs. It's a comparable library to babel

A fantastic library (authored by Ben Newman) that takes an AST and transforms it back into source code. The beauty of recast is that it tries to preserve as much of your codes existing formatting as possible.

– Reference



Another great library authored by Ben Newman. It exposes 2 kinds of helpers that you’ll be using: functions that allow you to verify assumptions about nodes, and functions that allow you to compose new nodes to be added to an existing AST.

– Reference


The representation of a single construct within an AST. An example of a node could be a node for a FunctionExpression. A node will often have many other nodes nested within it.

– Reference

For more information see the jscodeshift docs


An object that wraps a single node, and exposes an API to make modifying/inspecting information about the node simpler.

– Reference

For more information see the jscodeshift docs


A group of path objects that exposes helpers to transform all contained paths, or traverse them further. Collections are very similar to the object returned from jQuery’s \$() function.

– Reference

For more information see the jscodeshift docs


Builders are methods intended to create new AST nodes.

For example creating an import declaration with the importDeclaration() builder might look like this:


For more information see the jscodeshift docs