benjamn / benjamn/ast-types

Question: Finding ES6 Import statements

Open
#248 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
194
Avg merge
22h 43m
Merged PRs (30d)
10

Description

I used `babel-types`, `babel-generator`, `babylon` and `babel-traverse` to find ImportDeclarations within ES6 code.
But I need to preserve the formatting of the original file. So I came across `recast` and it looks like this might be a good library for my use case. But I can't figure out how to traverse for `ImportDeclaration`s. I looked into [defs/core.js](https://github.com/benjamn/ast-types/blob/master/def/core.js) and I couldn't find any `ImportDeclaration` specific definitions. Is this something babel specific?
SOme help would be really nice as I am quite new to AST manipulation and JS in general.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with defs/core.js and the ast-types traversal API, comparing them with the Babel tools and recast named in the issue. Done means documenting and verifying how to locate ImportDeclarations while preserving the original file formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.