jscodeshift(callback)
Runs jscodeshift transformation on the file.
import { files } from '@codemod.com/workflow' await files() .jsFam() .jscodeshift(({ source }, { j }) => { const root = j(source); root .find(j.Identifier) .replaceWith(j.literal('Hello')) return root.toSource() })
import type { API, FileInfo, Options } from "jscodeshift" type CallbackFunction = (file: FileInfo, api: API, options: Options) => Promise<void> | void
Callback replicates jscodeshift API, so any codemod created with jscodeshift can be used here.
Was this page helpful?