esquery
esquery copied to clipboard
Allow naked binaryOp at the start of a `has` selector
Fixes https://github.com/estools/esquery/issues/132, allowing users to write selectors with naked binary operators inside blocks, like FunctionExpression:has(> [name="foo"]).
This is achieved in two steps:
- Update to the Peg.js grammar.
- Handling the case of a missing left-hand selector inside a
hasblock, by injecting a selector corresponding to the node which is then sub-traversed, using a newexactNodetype.
I would love this PR to get a review from the maintainers...
@richsilv Is there any appetite for addressing the reviewer's comments and resubmitting? This downstream affects ts-query which I need for another project, and I unfortunately do not know pegjs to try and submit my own PR.
fixed by #145