- Clone the repo and
cd
intounderstanding-codemods
. - update deps -
yarn install
- install jscodeshift globally -
npm install -g jscodeshift
- No comment blocks - Remove all comments from the files
jscodeshift -t transformers/remove-comments.js index.js
- Adopt arrow functions - Replace all function definitions with arrow functions
jscodeshift -t transformers/to-arrow-functions.js index.js
- Replace require statements - Replace all “require” imports with es6 “import” statements
jscodeshift -t transformers/to-es6-imports.js index.js