No description or website provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
babel
eslint
.babelrc
.eslintrc.js
.gitignore
LICENSE
README.md
eslint-local-rules.js
package.json
yarn.lock

README.md

Fun with ASTs

This repo is a code companion of the AST’s and JavaScript: Write Code that Writes Code blog post that was posted in July of 2017 on ILM's Super Development blog. It contains code that shows how to:

  • write a babel plugin
  • run a babel plugin against javascript file(s) and emit tranformed javascript
  • run a babel plugin against javascript file(s) and update them in place (codemod)
  • test a babel plugin
  • write an eslint rule
  • test an eslint rule
  • apply local eslint rules against your codebase (without having to install via npm)

How to get started

Pull down this repo and install the package dependecies either via npm install or yarn install. A yarn.lock file is included in the repo so you're likely to have less problems with dependencies if you use yarn.

Scripts

The following scripts can be run (either using npm run SCRIPT or yarn run SCRIPT) to see these tools in action:

  • test - runs all test files (in babel and eslint folders)
  • lint - runs eslint using local eslint rule against eslint/src directory
  • babel:codemod - runs babel plugins against babel/func-api-change/src to update src files in place, essentially using babel as a codemod utility
  • babel:transform - runs babel plugins against files in babel/expensive-operation-logging/src and emits the altered javascript files to the babel-dist folder in project root