Practical Abstract Syntax Trees

Practical Abstract Syntax Trees

English | MP4 | AVC 1920×1080 | AAC 44KHz 2ch | 18 Lessons (1h 57m) | 383 MB

In this course, you’ll learn the fundamentals of abstract syntax trees, what they are, how they work, and dive into several practical use cases of abstract syntax trees to maintain a JavaScript codebase.

What You Will Learn

  • Abstract syntax tree fundamentals
  • JavaScript tools that work with abstract syntax trees
  • How to parse, traverse, and generate abstract syntax trees
  • Practical skill set for maintaining large JavaScript codebases

In this course, we’ll start with the fundamentals of abstract syntax trees (ASTs) and learn the basic mental models. This general AST knowledge can be translated to almost any tool that works with ASTs.

Why this course?
Understanding and using ASTs unlocks the ability to make sweeping changes in a safe and reliable way in any size codebase.

Course topics
Throughout this course, we’ll have converted source code into ASTs, traversed, mutated, and generated ASTs. With these concepts we’ll then explore several practical applications including things like code audits (static analysis), code transformations (codemods), and linting.

Module 1
We’ll learn the fundamentals of abstract syntax trees.

  • What is an AST?
  • How to explore an AST
  • Examples of JavaScript tools that work with ASTs

Module 2
We’ll learn how to work with ASTs.

  • How to turn code into an AST
  • How to programmatically navigate any AST
  • How to leverage TypeScript to prevent runtime errors

Module 3
We’ll learn how to statically analyze, or “audit” code to understand the state of the codebase using abstract syntax trees.

  • An introduction to an example codebase and refactor
  • Understanding the state of the current codebase
  • When to use an AST-based tool versus doing something manually

Module 4
We’ll learn how to transform, or “codemod” code from one state to another using abstract syntax trees.

  • How to make changes to an AST
  • How to change ASTs with jscodeshift
  • How to test a code transform

Module 5
We’ll learn how to write rules, or “lint” code using abstract syntax trees.

  • How to create rules for code
  • How to create custom rules with ESLint
  • How to test a rule
Table of Contents

1 Course overview
2 What is an AST?
3 Exploring an AST
4 JavaScript AST ecosystem
5 Environment setup
6 Generating a JavaScript AST
7 Traversing an AST
8 Preventing Runtime Errors (with Types)
9 Practical code audits
10 Performing a code audit
11 Adding the Button component
12 When to use AST-based tooling
13 Mutating an AST
14 Using jscodeshift
15 Testing a transform
16 Creating rules for code
17 Using ESLint
18 Testing custom linting rules

Homepage