Machine Powered Refactoring: Leverage AST's to Push Your Legacy Code (& the Web) Forward
summary
Argues that regex-based refactors fail on dynamic JavaScript and that parsing code into an AST gives a predictable, queryable structure for safe, large-scale changes. Demonstrates AST Explorer and using parsers plus jscodeshift / Recast to find nodes, rewrite identifiers into function declarations, and regenerate code; mentions Babel plugins like preval to pre-evaluate at build time. Cites HTTP Archive numbers: average site ~400 KB and ~15s mobile load, and notes only ~25% of teams feel their codebase is healthy.
AI-written summary · about
chapters (6)
- 0:00Introduction and speaker background
- 7:15State of JavaScript and tech debt
- 15:33Introducing Abstract Syntax Trees
- 24:03ASTs in tools like Babel
- 33:10Code modifications with ASTs
- 42:16Conclusion and resources
related talks
47mComputer, refactor my code!
20mThey see me refactorin'. They hatin'
34mMass Frontend Refactors: Less Stress; More Success
40mHow To (Semi-)Automate JavaScript Refactoring
21mAutomating Front-End Refactoring
40mRefactoring large JavaScript codebases
29mAST: the Secret Weapon to Transform a Codebase
29mCodemods: Refactoring JavaScript using JavaScript
