Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add utility methods for import specifiers #614

Open
mohab-sameh opened this issue Jul 29, 2024 · 3 comments
Open

docs: add utility methods for import specifiers #614

mohab-sameh opened this issue Jul 29, 2024 · 3 comments
Assignees

Comments

@mohab-sameh
Copy link
Collaborator

Document utility methods for import specifiers as described in #611.

@JakobJingleheimer
Copy link

Would be great to get some docs on these! The current documentation defines things with themselves, and there is no explanation on how to use them.

For instance, filter(j.ImportSpecifier)'s result do not contain the actual specifier. filter(j.ImportDeclaration)'s result does, but then re-composing a replacement is 🤯

@mohab-sameh
Copy link
Collaborator Author

@JakobJingleheimer agreed. I'll work on this soon. The current AST Grammar doc was supposed to be just an exhaustive reference of all the node type definitions rather than a usage guide. I'm wondering if that's even useful since it's not likely someone will need a list of node types in a doc format because:

  1. they're already defined in the source code
  2. tools like Codemod Studio and AST Explorer already allow users to know what node type a piece of code is

Should we have a doc with example usages of different node types instead? What's the ideal experience you want to see here?

@JakobJingleheimer
Copy link

Yeah, example usage would be great!

For instance when to filter by identifier vs importSpecifier vs importDeclaration etc and then how to build the return.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants