esquery icon indicating copy to clipboard operation
esquery copied to clipboard

Add optional JSX-Support while keeping original behaviour the default

Open allesklarbeidir opened this issue 8 years ago • 3 comments

Esquery is a great module which I love to use. However, unfortunately one was not able to use it with code which includes JSX-Expressions because the "normal" estraverse module is used. Luckily there already exists an estraverse-fb module which adds JSX-Support to the estraverse module in a "plug-in" way.

With this pull-request we can integrate the option to use "estravese-fb" instead of pure "estraverse" and enable querying of JSX-containing code. The default behaviour remains as it was without this modification. The readme is also updated to reflect the new option for JSX-Support.

allesklarbeidir avatar Jun 12 '17 12:06 allesklarbeidir

I'd propose to merge this pull request before any other modification is made to the repository so that jsx support is preserved for future versions.

allesklarbeidir avatar Jul 20 '17 07:07 allesklarbeidir

+1 It would be great to have this support so we can query ASTs generated with esprima from sources containing JSX.

jorgerro avatar Oct 04 '17 21:10 jorgerro

Thank for raising this PR.

Would be great to get this merged in. I have forked the repo and published it NPM with jsx support:

[email protected]

thabti avatar Oct 06 '18 19:10 thabti