Ban Dependencies with Certain Tags
Specifying which tags a project is allowed to depend on can sometimes lead to a long list of possible options:
1{
2 "sourceTag": "scope:client",
3 // we actually want to say it cannot depend on `scope:admin`
4 "onlyDependOnLibsWithTags": [
5 "scope:shared",
6 "scope:utils",
7 "scope:core",
8 "scope:client"
9 ]
10}
11
The property notDependOnLibsWithTags
is used to invert this condition by explicitly specifying which tag(s) it cannot depend on:
1{
2 "sourceTag": "scope:client",
3 // we accept any tag except for `scope:admin`
4 "notDependOnLibsWithTags": ["scope:admin"]
5}
6
In contrast to
onlyDependOnLibsWithTags
, thenotDependOnLibsWithTags
will also follow down the entire dependency tree to make sure there are no sub-dependencies that violate this rule. You can also use a combination of these two rules to restrict certain types of projects to be imported:
1{
2 "sourceTag": "type:react",
3 "onlyDependOnLibsWithTags": [
4 "type:react",
5 "type:utils",
6 "type:animation",
7 "type:model"
8 ],
9 // make sure no `angular` code ends up being referenced by react projects
10 "notDependOnLibsWithTags": ["type:angular"]
11}
12