<commit_before># Fun with ASTs

This repo is a code companion of the Changing code with code blog 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<commit_msg>updated blog post link<commit_after># Fun with ASTs

This repo is a code companion of the [AST’s and JavaScript: Write Code that Writes Code](https://superdevelopment.com/2017/07/24/asts-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

{'fraction_non_alphanumeric': 0.06363325350667123, 'fraction_numerical': 0.005473828258638385, 'mean_word_length': 4.485928705440901, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6357292', 'n_tokens_mistral': 859, 'n_tokens_neox': 785, 'n_words': 431}