-
Notifications
You must be signed in to change notification settings - Fork 33
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
How to match import specifier by id? #106
Comments
Finally getting somewhere, but not quite... const find = `import-dec > specifiers import-default-specifier[id=#x]`
const replace = `y`
const replacer = grasp.replace('squery', find, replace) How do I select on the outer import node and not the specifier? Even in this case, the specifier is not replaced by |
Can you give a better example of what you want? ie. this is the code you have, this is what you want matched. It is unclear from your post Are you wanting to use grasp "import-dec! import-default-specifier[local=#x]"? ie using http://www.graspjs.com/docs/squery/#subject |
oh, wow! Thanks @gkz exactly what I wanted. I wish you had some more examples on how to use the query/select syntax to such great effect for more complex queries. Cheers! |
Perfect! It works like a charm! Thanks again :) |
As per estools/esquery#50
How do I match
import x
in the following!?Error: Expected operator ), but found: {"type":"operator","value":"="}
Or why not?
import-dec[specifiers[id=#x]]
ORimport-dec[specifiers=(import-default-specifier[id=#x])]
TypeError: Cannot read property 'nodes' of undefined
(last attempt)From esprima parser
The text was updated successfully, but these errors were encountered: