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
Exceptions when traversing using sibling, adjacent and nth-child selectors and non-standard AST nodes #13639
Exceptions when traversing using sibling, adjacent and nth-child selectors and non-standard AST nodes #13639
Comments
I think we should treat this as a bug, since our selectors documentation lists those selectors, so it's reasonable to expect that they can work with custom parsers. Also, they'll crash even with the default parser on any JSX code, as in this demo. It's true that this needs to be supported in Relevant PR: estools/esquery#112 An alternative is to remove those selectors from the documentation. If this doesn't get fixed, it seems best not to use them at all. |
disabled no-closure-siblings rule to prevent crash with typescript plugin (see eslint/eslint#13639)
|
Also, |
@brettz9 can you please open a separate issue about the new esquery syntax? 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. |
@mdjermanovic : Thanks, I've filed #14076 . |
Tell us about your environment
What parser (default,
@babel/eslint-parser
,@typescript-eslint/parser
, etc.) are you using?@typescript-eslint/parser
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
eslint-plugin-test
source:lint file source:
What actually happened? Please include the actual, raw output from ESLint.
Context
Original issue: typescript-eslint/typescript-eslint#2439
Investigation so far:
Our parser (
@typescript-eslint/parser
) returns an extended list of visitor-keys (as specified by the ESLint docs) right hereHowever
esquery
uses its own (hard coded) visitor keys for 3 selectors:~
:https://github.com/estools/esquery/blob/e27e73d8cde63a2eb1aba3424510ce1b714d207e/esquery.js#L239
+
https://github.com/estools/esquery/blob/e27e73d8cde63a2eb1aba3424510ce1b714d207e/esquery.js#L275
:nth-child(n)
https://github.com/estools/esquery/blob/e27e73d8cde63a2eb1aba3424510ce1b714d207e/esquery.js#L309
So I think that this is this something we'll have to PR into the underlying esquery library?
The text was updated successfully, but these errors were encountered: