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
Docs: Mention workaround for escaping the slash character in selectors #14675
Conversation
Hi @AriaMinaei!, thanks for the Pull Request The first commit message isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.
Read more about contributing to ESLint here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be fixed the the package?
Not sure, because the relevant bug has been unresolved for a couple of years already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks
docs/developer-guide/selectors.md
Outdated
|
||
### Known issues | ||
|
||
Due to a [bug](https://github.com/estools/esquery/issues/68) in [esquery](https://github.com/estools/esquery), regular expressions that contain a forward-slash character `/` aren't porperly parsed, so `[value=/some\/path/]` will be a syntax error. As a [workaround](https://github.com/estools/esquery/issues/68), you can replace the `/` character with its unicode counterpart, like so: `[value=/some\\u002Fpath/]`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\\
in [value=/some\\u002Fpath/]
might be confusing. Selector itself should have only one \
, while the other \
is required only if the selector is represented in a string literal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest only \
here (like it is in [value=/some\/path/]
), and an example that disallows import from foo/bar
:
{
"rules": {
"no-restricted-syntax": ["error", "ImportDeclaration[source.value=/foo\\u002Fbar/]"]
}
}
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Hi @AriaMinaei!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.
Read more about contributing to ESLint here |
I think this is close enough to merge. We can make other tweaks later. |
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[x] Documentation update
What changes did you make? (Give an overview)
A small documentation change to mention the workaround for the esquery issue that prevents the forward-slash character to be escaped in regular expressions, when used in
no-restricted-syntax
.