-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Rule banning complex ESQuery selectors #339
Comments
We'd welcome a rule for this, as some plugin authors may prefer to avoid complex selectors. However, I would lean toward any such rule to be optional and not recommended. It feels too opinionated to be in the recommended config. I wouldn't want to prevent plugin authors from taking full advantage of selectors if they prefer that style. |
I would like to contribute this rule but I think there needs to be discussion about what a complex selector is. Valid Examples:
Invalid examples:
But as basically none of the selector syntax is used, it should be clear what and what is not allowed (versus different rule options, e.g. allowing maximally one attribute selector, ...). This also makes other rules for node selectors unnecessary (e.g. formatting or whether a selector can be simplified). Further this allows the callback parameters to be easily typeable (see #340) I tried the above rules on my own rules and found no cases where I did not find it preferrable. |
Yeah it's a good question. typescript-eslint/typescript-eslint#4065 shows @auvred's really nifty library, |
Moving discussion from typescript-eslint/typescript-eslint#6444 (comment) here, and quoting @bradzacher:
Is there any consensus/desire here to limit ESQuery node types?
Proposed "bad":
Proposed "good":
The text was updated successfully, but these errors were encountered: