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
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,17 +14,20 @@ The default for `basePath` is the current working directory.
14
14
15
15
Each zone consists of a `target`, a `from`, and optional `except` and `message` attributes.
16
16
17
-
-`target` - Identifies files where import restrictions will be applied. It can be expressed by:
17
+
-`target` - Identifies which files are part of the zone. It can be expressed as:
18
18
- A simple directory path, matching all files contained recursively within it
19
19
- A glob pattern
20
20
- An array of any of the two types above
21
-
-`from` - Identifies the folders that targeted files are not allowed to import from. It can be expressed by:
21
+
-*Example: `target: './client'` - this zone consists of all files under the 'client' dir*
22
+
-`from` - Identifies folders from which the zone is not allowed to import. It can be expressed as:
22
23
- A simple directory path, matching all files contained recursively within it
23
24
- A glob pattern
24
25
- An array of only simple directories, or of only glob patterns (mixing both types within the array is not allowed)
26
+
-*Example: `from: './server'` - this zone is not allowed to import anything from the 'server' dir*
25
27
-`except` - Optional. Allows exceptions that would otherwise violate the related `from`. Note that it does not alter the behaviour of `target` in any way.
26
28
- If `from` is an array of glob patterns, `except` must be an array of glob patterns as well.
27
29
- If `from` is an array of simple directories, `except` is relative to `from` and cannot backtrack to a parent directory.
30
+
-*Example: `except: './server/config'` this zone is allowed to import server config, even if it can't import other server code*
28
31
-`message` - Optional. Displayed in case of rule violation.
29
32
30
33
*Note: The `from` attribute is NOT matched literally against the import path string as it appears in the code. Instead, it's matched against the path to the imported file after it's been resolved against `basePath`.*
0 commit comments