kentcdodds / kentcdodds/slice-js

Improve the core plugin

Open
#5 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
17
Forks
8
PR merge metrics
No merged PRs in 30d

Description

There's definitely some code that the core plugin can't safely operate on yet. My ultimate measure of success is when we're able to generate a slice of the UMD builds of lodash, React, Angular 2, Ember, and jQuery. That would be sooooo awesome. But right now if you try you'll have two problems:
1. Perf is no good (see #3)
2. You get an error (probably that some node expected a property to be an Expression but was undefined).

Turns out that safely removing nodes is a really hard thing to do. You often end up removing too much. So we need to just keep trying more code of varying styles and adding them to the test suit.

Here's a great way to get started doing that:

![ast-button](https://cloud.githubusercontent.com/assets/1500684/20146688/c3b26b2c-a659-11e6-8c57-5f6f0b9a16b0.gif)

Once you've gotten the plugin fixed up, just copy the source you're slicing to [fixtures](https://github.com/kentcdodds/slice-js/tree/1599643fd384c1699f5c82c834656c5ba54ad1c0/src/slice-code/test/fixtures) and add a `.test.js` file [here](https://github.com/kentcdodds/slice-js/tree/1599643fd384c1699f5c82c834656c5ba54ad1c0/src/slice-code/test) (see the other ones there for an idea of how to use the utils).

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the slicing error and performance issue described in the issue, then inspect the core plugin and the existing tests under src/slice-code/test. Add representative source files to src/slice-code/test/fixtures and matching .test.js files, following the existing test utilities. Done means the added cases slice safely without the reported undefined Expression error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.