Skip to content

Commit f82095e

Browse files
authored
Update no-restricted-paths.md
Add examples and clarify wording
1 parent cee8482 commit f82095e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docs/rules/no-restricted-paths.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ The default for `basePath` is the current working directory.
1414

1515
Each zone consists of a `target`, a `from`, and optional `except` and `message` attributes.
1616

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:
1818
- A simple directory path, matching all files contained recursively within it
1919
- A glob pattern
2020
- 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:
2223
- A simple directory path, matching all files contained recursively within it
2324
- A glob pattern
2425
- 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*
2527
- `except` - Optional. Allows exceptions that would otherwise violate the related `from`. Note that it does not alter the behaviour of `target` in any way.
2628
- If `from` is an array of glob patterns, `except` must be an array of glob patterns as well.
2729
- 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*
2831
- `message` - Optional. Displayed in case of rule violation.
2932

3033
*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

Comments
 (0)