Skip to content
Permalink
e163ea39a8
Go to file
 
 
Cannot retrieve contributors at this time
19 lines (15 sloc) 482 Bytes
import jscodeshift from 'jscodeshift';
import { Plugin } from 'ts-migrate-server';
type Options = {};
const j = jscodeshift.withParser('tsx');
const examplePluginJscodeshift: Plugin<Options> = {
name: 'example-plugin-jscodeshift',
async run({ text }) {
const root = j(text);
root
.find(j.Identifier)
.replaceWith((p) => j.identifier(p.node.name.split('').reverse().join('')));
return root.toSource();
},
};
export default examplePluginJscodeshift;
You can’t perform that action at this time.