Skip to content

Commit f8e4a91

Browse files
author
Rebecca Stevens
committed
docs(no-restricted-paths): update docs with details on the new option allowedImportKinds
re #1899
1 parent fde081b commit f8e4a91

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

docs/rules/no-restricted-paths.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ In order to prevent such scenarios this rule allows you to define restricted zon
88
## Rule Details
99

1010
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-
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.
11+
It may also specify an `allowedImportKinds`.
12+
The default value for `basePath` is the current working directory and the default value for `allowedImportKinds` is an empty array.
13+
14+
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. Additionally an override of `allowedImportKinds` can be given for each zone.
1315
You may also specify an optional `message` for a zone, which will be displayed in case of the rule violation.
1416

1517
### Examples
@@ -64,7 +66,8 @@ and the current configuration is set to:
6466
"target": "./tests/files/restricted-paths/server/one",
6567
"from": "./tests/files/restricted-paths/server",
6668
"except": ["./one"]
67-
} ] }
69+
} ],
70+
"allowedImportKinds": ["type"] }
6871
```
6972

7073
The following pattern is considered a problem:
@@ -73,8 +76,12 @@ The following pattern is considered a problem:
7376
import a from '../two/a'
7477
```
7578

76-
The following pattern is not considered a problem:
79+
The following patterns are not considered a problem:
7780

7881
```js
7982
import b from './b'
8083
```
84+
85+
```ts
86+
import type T from '../two/a'
87+
```

0 commit comments

Comments
 (0)