estools / esquery

ECMAScript AST query library.
http://estools.github.io/esquery/
Other
816 stars 88 forks source link

Allow naked binaryOp at the start of a `has` selector #133

Closed richsilv closed 2 months ago

richsilv commented 1 year ago

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:

  1. Update to the Peg.js grammar.
  2. Handling the case of a missing left-hand selector inside a has block, by injecting a selector corresponding to the node which is then sub-traversed, using a new exactNode type.
moniuch commented 1 year ago

I would love this PR to get a review from the maintainers...

AustinGrey commented 9 months ago

@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.

michaelficarra commented 2 months ago

fixed by #145