-
Notifications
You must be signed in to change notification settings - Fork 91
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
Feature Request: get target node type from selector #38
Comments
I'm not sure I understand your use case. Can you explain what |
Yes, I've looked at esdispatch, and I don't like the approach of checking every node against every selector. I'd also rather have a direct dependency on esquery rather than having it be one step away in the dependency tree. What I want is a way to narrow down which selectors should be checked against which nodes rather than always checking every one.
|
Is this going to happen? I can make this functionality myself, it just seems like a nice fit with this library to bundle it. And is esquery still under development? It looks like there hasn't been much movement recently. |
So I think you're confused about the matching process. Determining the "target type" is as expensive as doing a full match. Matching edit: By the way, since esdispatch knows all of the selectors, we can build an optimised automaton to avoid performing the same test more than once. I'm still happy to work on esquery, but I have no incentive right now. I don't run into any of the currently open issues myself, they're pretty much all minor, and there's no big widely-used project relying on it yet. |
Yes, I don't want to have to run every query on every node - that seems I may be missing something, but it seems like determining the target node You have a bit of a chicken-and-egg problem. I'm afraid of relying on |
I'm looking at using esquery in ESLint, and it looks very close to what I need for the implementation I have in mind. The one thing that is missing is a way to figure out the target node type of a given selector. Basically, something that can take the selector AST and returns:
Basically, my implementation will look like:
The text was updated successfully, but these errors were encountered: