esquery icon indicating copy to clipboard operation
esquery copied to clipboard

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

Open richsilv opened this issue 3 years ago • 2 comments

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.

richsilv avatar Dec 06 '22 16:12 richsilv

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

moniuch avatar Mar 11 '23 10:03 moniuch

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

AustinGrey avatar Dec 15 '23 00:12 AustinGrey

fixed by #145

michaelficarra avatar Jul 08 '24 16:07 michaelficarra