diff --git a/docs/src/developer-guide/selectors.md b/docs/src/developer-guide/selectors.md index e0609864109..4be7795d287 100644 --- a/docs/src/developer-guide/selectors.md +++ b/docs/src/developer-guide/selectors.md @@ -137,4 +137,16 @@ Using selectors in the `no-restricted-syntax` rule can give you a lot of control ### 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 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/]`. +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/]`. + +For example, the following configuration disallows importing from `some/path`: + +```json +{ + "rules": { + "no-restricted-syntax": ["error", "ImportDeclaration[source.value=/^some\\u002Fpath$/]"] + } +} +``` + +Note that the `\` character needs to be escaped (`\\`) in JSON and string literals.