The magical land of AST's with babel, eslint and codemods
Submitted by Vivek Nayyar (@viveknayyar09) on Wednesday, 26 December 2018
AST’s are everywhere. They are a part of majority of our tools that we use today for development.
We use babel, eslint and AST’s power them.
Come join me in this journey of understanding the magical land of AST’s by creating babel and eslint plugins and writing custom codemods.
Being a software dev for more than 4 years now, I was always curious to understand how these
instruction’s that we give to our machine’s get understood and sometimes modified for optimizations.
It was initially scary because to me it appeared to be really complicated and would require me to understand the nuances of how machines work, which basically means understanding how a kernel works, how bits and bytes work or taking a deep dive into how compilers work.
But turns out it is not as complicated as I thought it to be.
So let me take you all to this magical journey of understanding how AST’s work and how we can all, no matter what our experience is create something really interesting using AST’s.
By understanding them we would also:-
1) Become better at writing our JS code
2) Better understand JS scopes
3) Better understand how compilers/transpilers work
4) We would be able to write our very first babel plugin
5) We would be amazed when we see how easy it is to write our first eslint plugin
6) And we would learn about this cool new thing called as codemods using jscodeshift
Outline of the talk
Brief introduction to AST’s - 5 mins
Stages of any compiler - 5 mins
Why babel, what are babel plugins and presets? - 5 mins
Creating few babel plugins - live coding - 10 mins
Creating an eslint plugin - live coding - 5 mins
Creating a codemod - live coding - 10 mins
Front-End Engineer with more than 4 year’s of experience building products for numerous domain’s like e-commerce, real estate, video-streaming and now Fin-Tech with Trusting Social.