Support/Document `:has()` selectors (per esquery update)
See original GitHub issueThe version of ESLint you are using.
7.19.0
The problem you want to solve.
esquery
has just published a new release with the support for custom visitor keys (that may contribute to fixing #13639 ), which brings parser-independent support including for has:()
selectors.
However, https://github.com/eslint/eslint/blob/master/docs/developer-guide/selectors.md does not indicate support for :has()
, and per https://github.com/eslint/eslint/issues/13639#issuecomment-774577141 there may be some work to do to be able to support them:
ESLint selectors are using esquery, but we’re also doing some optimizations and calculating specificity in NodeEventGenerator, so it’s possible that some additional work has to be done before we can say that ESLint fully supports new selectors.
(Note that in addition to :has()
the “subject” indicator is also supported, but per https://github.com/estools/esquery/pull/61 , that implementation is buggy while the :has()
one was working enough to be used as a base for the former–though with one issue on relative keys mentioned there.)
Your take on the correct solution to problem.
No special take. Ideally would provide support for the selectors and update the docs.
Are you willing to submit a pull request to implement this change?
No.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:15 (15 by maintainers)
Top GitHub Comments
Sorry, by “error” I meant a linting problem, i.e., the selector in the
no-restricted-syntax
config matches literal1
.I filed an issue in esquery repo: https://github.com/estools/esquery/issues/122
I’ll champion this.