Skip to content

Commit 7b04401

Browse files
committed
feat(schema): adds 'via' and 'viaOnly' attributes to reachable restrictions
1 parent 64d42f9 commit 7b04401

7 files changed

Lines changed: 59 additions & 4 deletions

src/schema/configuration.schema.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/schema/configuration.validate.mjs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/schema/cruise-result.schema.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/schema/cruise-result.validate.mjs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/schema/restrictions.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,26 @@ export default {
285285
"Whether or not to match modules that aren't reachable from the from " +
286286
"part of the rule.",
287287
},
288+
via: {
289+
description:
290+
"For reachable rules - whether or not to match paths that include " +
291+
"some modules with these conditions. If you want to match paths that " +
292+
"_exclusively_ include modules satisfying them use the viaOnly " +
293+
"restriction." +
294+
"E.g. to allow all paths, " +
295+
"except when they go through one specific module. Typically to temporarily " +
296+
"disallow some paths with a lower severity - setting up a rule with a via " +
297+
"that ignores them in an 'allowed' section.",
298+
$ref: "#/definitions/MiniDependencyRestrictionType",
299+
},
300+
viaOnly: {
301+
description:
302+
"For reachable rules - whether or not to match paths that include " +
303+
"exclusively modules with these conditions. This is different from " +
304+
"the regular via that already matches when only _some_ of the modules in the " +
305+
"path satisfy the condition.",
306+
$ref: "#/definitions/MiniDependencyRestrictionType",
307+
},
288308
},
289309
},
290310
RequiredModuleRestrictionType: {

types/restrictions.d.mts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export interface IToRestriction extends IBaseRestrictionType {
7373
*/
7474
via?: MiniDependencyRestrictionType;
7575
/**
76-
* "For circular dependencies - whether or not to match cycles that include
76+
* For circular dependencies - whether or not to match cycles that include
7777
* exclusively modules with this regular expression. This is different from
7878
* the regular via that already matches when only some of the modules in the
7979
* cycle satisfy the regular expression
@@ -88,7 +88,7 @@ export interface IToRestriction extends IBaseRestrictionType {
8888
*/
8989
viaNot?: string | string[];
9090
/**
91-
* "For circular dependencies - whether or not to match cycles that include
91+
* For circular dependencies - whether or not to match cycles that include
9292
* _some_ modules that don't satisfy this regular expression.
9393
* @deprecated use via.pathNot in stead
9494
*/
@@ -163,6 +163,23 @@ export interface IReachabilityToRestrictionType extends IBaseRestrictionType {
163163
* Whether or not to match modules that aren't reachable from the from part of the rule.
164164
*/
165165
reachable: boolean;
166+
/**
167+
* For reachable rules - whether or not to match paths that include
168+
* some modules with these conditions. If you want to match paths that
169+
* _exclusively_ include modules satisfying them use the viaOnly
170+
* restriction.
171+
* E.g. to allow all paths, except when they go through one specific module.
172+
* Typically to temporarily disallow some 'forbidden' paths with a lower severity
173+
* - setting up a rule with a via that ignores them in an 'allowed' section.
174+
*/
175+
via?: MiniDependencyRestrictionType;
176+
/**
177+
* For reachable rules - whether or not to match paths that include
178+
* exclusively modules with these conditions. This is different from
179+
* the regular via that already matches when only _some_ of the modules in the
180+
* path satisfy the condition.
181+
*/
182+
viaOnly?: MiniDependencyRestrictionType;
166183
}
167184

168185
export interface IRequiredToRestrictionType {

types/strict-restrictions.d.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ interface IStrictToRestriction extends IToRestriction {
3737
export interface IStrictReachabilityToRestrictionType extends IReachabilityToRestrictionType {
3838
path?: string;
3939
pathNot?: string;
40+
via?: IStrictMiniDependencyRestriction;
41+
viaOnly?: IStrictMiniDependencyRestriction;
4042
}
4143

4244
export interface IStrictRequiredToRestrictionType extends IRequiredToRestrictionType {

0 commit comments

Comments
 (0)