Welcome to
Practical Abstract Syntax Trees
Course Syllabus and Content
Understanding Abstract Syntax Trees (AST)
4 Lessons 13 Minutes
Understand the basics of an AST and how it relates to real-world code
Looking at an example code snippet and how it relates to the resulting AST
An overview of the tooling available in the web frontend (JavaScript) ecosystem that rely on ASTs
A quick overview of the basic environment setup used throughout this course
Working with Abstract Syntax Trees
3 Lessons 23 Minutes
Exploring tools to convert (or parse) JavaScript into a real AST
Programmatically traverse an AST and visit arbitrary nodes
See how types can surface runtime errors
Code Audits
4 Lessons 22 Minutes
A practical example of needing to perform a code audit (static analysis) to understand the current state of a codebase
Create a custom script to audit a codebase
Introduce a shared Button component to replace all existing button elements
A rough formula to determine when to use AST-based tooling
Codemods
3 Lessons 37 Minutes
Transforming code in place by mutating an AST
Using jscodeshift to make the same code transformations with less boilerplate
Create tests for jscodeshift transforms for a faster feedback loop
Linting
3 Lessons 18 Minutes
Implement a linting rule to prevent the code we just transformed from being reintroduced in the future
Use ESLint to create the same linting rule for the code with less boilerplate
Testing custom ESLint linting rules to verify they work as expected