JavaScript ❤ binary data
summary
Demonstrates using JavaScript ASTs (via Babel tools) to reliably analyze and transform code instead of regexes: builds a detector/remover for console.log and debugger that passes 17 tests and correctly handles comments, strings, templates and call-site edge cases. Uses babel-traverse, babel-types and code generation to replace AST nodes, explores AST Explorer to show why nodes can have many properties, and turns the tool into an ESLint-style fixer used as a precommit script.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 4:59Regex limitations
- 5:20What is AST
- 10:03AST structure example
- 14:25Finding console.log with AST
- 20:36Removing console.log
- 22:25Finding and removing debugger with AST
- 27:01AST practical uses
- 30:13AST tools and libraries
- 33:11Preserving formatting
- 36:45Finding console.log with IDE
- 39:18Q&A
related talks
44mJavaScript AST programming: Introduction and beyond
31mAST à la Vista, Baby
22mHow Linters, Compilers & Other Cool Things Work
20mJavaScript Transformation
28mMaster the art of the AST and take control of your JS
31mThe Different Transformation Stages of AOT Compilers
20mThey see me refactorin'. They hatin'
38mThe magical land of AST's with babel, eslint and codemods
