Skip to content

Commit 6070f58

Browse files
authored
docs: clarify esquery issue workaround (#16556)
1 parent b48e4f8 commit 6070f58

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

docs/src/developer-guide/selectors.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,16 @@ Using selectors in the `no-restricted-syntax` rule can give you a lot of control
137137

138138
### Known issues
139139

140-
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 properly 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/]`.
140+
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 properly 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/]`.
141+
142+
For example, the following configuration disallows importing from `some/path`:
143+
144+
```json
145+
{
146+
"rules": {
147+
"no-restricted-syntax": ["error", "ImportDeclaration[source.value=/^some\\u002Fpath$/]"]
148+
}
149+
}
150+
```
151+
152+
Note that the `\` character needs to be escaped (`\\`) in JSON and string literals.

0 commit comments

Comments
 (0)