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/src/rules/no-restricted-imports.md
+48-1Lines changed: 48 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -389,7 +389,7 @@ import pick from 'import1/private/someModule';
389
389
390
390
The `patterns` array can also include objects. The `group` property is used to specify the `gitignore`-style patterns for restricting modules and the `message` property is used to specify a custom message.
391
391
392
-
The `group` property is required property when using objects inside the `patterns`array.
392
+
Either of the `group`or `regexGroup`property is required when using the `patterns`option.
393
393
394
394
```json
395
395
"no-restricted-imports": ["error", {
@@ -433,6 +433,53 @@ import lodash from 'lodash';
433
433
434
434
:::
435
435
436
+
#### regexGroup
437
+
438
+
The `regexGroup` property is used to specify the regex patterns for restricting modules.
439
+
440
+
```json
441
+
"no-restricted-imports": ["error", {
442
+
"patterns": [{
443
+
"regexGroup": "import1/private/",
444
+
"message": "usage of import1 private modules not allowed."
445
+
}, {
446
+
"regexGroup": "import2/(?!good)",
447
+
"message": "import2 is deprecated, except the modules in import2/good."
448
+
}]
449
+
}]
450
+
```
451
+
452
+
Examples of **incorrect** code for `regexGroup` option:
0 commit comments