You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/no-restricted-paths.md
+48-2Lines changed: 48 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,8 +9,18 @@ In order to prevent such scenarios this rule allows you to define restricted zon
9
9
10
10
This rule has one option. The option is an object containing the definition of all restricted `zones` and the optional `basePath` which is used to resolve relative paths within.
11
11
The default value for `basePath` is the current working directory.
12
-
Each zone consists of the `target` path and a `from` path. The `target` is the path where the restricted imports should be applied. The `from` path defines the folder that is not allowed to be used in an import. An optional `except` may be defined for a zone, allowing exception paths that would otherwise violate the related `from`. Note that `except` is relative to `from` and cannot backtrack to a parent directory.
13
-
You may also specify an optional `message` for a zone, which will be displayed in case of the rule violation.
12
+
13
+
Each zone consists of the `target` path, a `from` path, and an optional `except` and `message` attribute.
14
+
-`target` is the path where the restricted imports should be applied. It can be expressed by
15
+
- directory string path that matches all its containing files
16
+
- glob pattern matching all the targeted files
17
+
-`from` path defines the folder that is not allowed to be used in an import. It can be expressed by
18
+
- directory string path that matches all its containing files
19
+
- glob pattern matching all the files restricted to be imported
20
+
-`except` may be defined for a zone, allowing exception paths that would otherwise violate the related `from`. Note that it does not alter the behaviour of `target` in any way.
21
+
- in case `from` is a glob pattern, `except` must be an array of glob patterns as well
22
+
- in case `from` is a directory path, `except` is relative to `from` and cannot backtrack to a parent directory.
23
+
-`message` - will be displayed in case of the rule violation.
14
24
15
25
### Examples
16
26
@@ -77,4 +87,40 @@ The following pattern is not considered a problem:
0 commit comments