benjamn / ast-types

Esprima-compatible implementation of the Mozilla JS Parser API
MIT License
1.13k stars 196 forks source link

Scope constructor `instanceof` check #144

Open pieterv opened 8 years ago

pieterv commented 8 years ago

When writing Jest unit tests for a jscodeshift codemod (https://github.com/cpojer/js-codemod/pull/2) the Scope constructor instanceof check fails, I haven't fully tracked down whats causing it (maybe related to running in a child process) but i can see the transform is working fine locally via jscodeshift or via http://astexplorer.net/#/LDGg3pg5ne

What is the purpose of this check? Im wondering if it can be achieved another way? i'm happy to do a PR if you're cool with changing it.

cc @cpojer @benjamn

pieterv commented 8 years ago

@cpojer figured out my specific case :) but it would be great to check this in a less error prone way. Feel free to close if you dont think its worth it.

cpojer commented 8 years ago

There we go: https://github.com/reactjs/react-codemod/commit/c95c1eaf825c621a5101dd37d8134f9e6be6468c