//TODO Write linting rules to enforce your team’s code conventions Write your own javascript transpiling code
Write powerful “code-mods” to automatically refactor thousands of legacy scripts from ES5 to ES6
Slide 3
//TODO Write linting rules to enforce your team’s code conventions
ESLint
Write your own javascript transpiling code
Write powerful “code-mods” to automatically refactor thousands of legacy scripts from ES5 to ES6
jscodeshift
Slide 4
//TODO Write linting rules to enforce your team’s code conventions
ESLint ESTreebased AST
Write your own javascript transpiling code
Write powerful “code-mods” to automatically refactor thousands of legacy scripts from ES5 to ES6
+
Visitor Pattern jscodeshift
I/ { O { Generate code cbd http://flic.kr/p/3xNFue
Slide 28
jscodeshift
Slide 29
Babel
jscodeshift
Input ➡ Output
Javascript ➡ Javascript
Javascript ➡ Javascript
Plugin-based
Yes
Yes
Building Block
AST-to-AST Transform function
AST-to-AST Transform function
Endorsed by
Facebook
Facebook
cb http://flic.kr/p/91r3Wz
Slide 30
Babel
jscodeshift
Input ➡ Output
Javascript ➡ Javascript
Javascript ➡ Javascript
Plugin-based
Yes
Yes
Building Block
AST-to-AST Transform function
AST-to-AST Transform function
Endorsed by
Facebook
Facebook
Goal
Compiler
"Codemod" (refactoring)
Example Use
ES6 ➡ ES5
ES5 ➡ ES6
Output level
Lower level than source
Same level as source
Output readability
Best-effort (boilerplate code)
High
Usage frequency
All the time
One-time
cb http://flic.kr/p/91r3Wz