JavaScript Tools at Scale Using Type Information
summary
A set of tools uses declared and inferred types to find and change real code patterns at scale: RefasterJS rewrites direct assignments like location.href into calls to goog.dom.safe, running across large repositories in minutes (mapreduce over hundreds/thousands/millions of files) and preventing XSS by construction; a closure compiler conformance layer emits compiler errors for banned idioms. It works reliably when type info exists but yields false positives where inference is weak.
AI-written summary · about
chapters (13)
- 0:00Start
- 0:44JavaScript Lines of Code at Google
- 2:07RefasterJS
- 2:48Running Example
- 7:25Build AST
- 9:15Matching AST structures
- 9:321. Match just node structure
- 10:17Match node structure and name
- 11:52Match node structure, name, or JS type
- 16:39Limitations - Missing Type information
- 18:26JS Conformance Framework
- 20:06Conformance Types
- 20:24Another example








