Transformers - codemods in disguise
summary
A concrete example: a codemod is written to convert badFunction → goodFunction across a large Ember codebase, handling the simple callback case and the object+string case by constructing an arrow function that calls obj.success rather than relying on fragile regex. The workflow uses jscodeshift + AST Explorer + recast (parsers: Babel/Esprima), proves regex is insufficient, and becomes runnable via npx with a shared toolchain (RWJ blue slash code Matt CLI) that auto-generates input/output docs and tests.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 2:07Story of a feature developer
- 8:48Excuses for not refactoring
- 14:58Enter JSCodeshift
- 21:15Live codemod demo
- 32:04Codemod CLI tool
- 34:54Conclusion and thanks
related talks
28mCross-File Codemodding
47mComputer, refactor my code!
34mCodemods and Transforming JavaScript Code
21mAutomating Front-End Refactoring
40mRefactoring large JavaScript codebases
27mHow Codemods Turned a Nightmare into a 3-Minute Migration
33mEmbracing Black Magic: The Power of Code Transpilation
25mWriting Code to Update our Code
