@nrwl/nx/enforce-module-boundaries allow AND/OR
See original GitHub issueDescription
Allow AND/OR usage with tags.
Motivation
Currently the behavior is OR only, having AND would enable many more combinations to be possible without introducing new tags.
Suggested Implementation
Not so much implementation but an example api
"depConstraints": [
{
"sourceTag": "layer:ui",
"onlyDependOnLibsWithTags": [{
"tags": ["scope:admin", "layer:backend"],
"operation": "AND"
}]
},
]
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Enforce Project Boundaries - Nx
Project APIs Nx provides an enforce-module-boundaries eslint rule that enforces the public API of projects in the repo. Each project defines its public...
Read more >Taming Code Organization with Module Boundaries in Nx
Using common sense, we would like to enforce certain boundaries: A shared or core library should not be able to depend on a...
Read more >Taming Code Organization with Module Boundaries in Nx
Zack DeRose is joined by Nrwlian Miroslav Jonas to talk about Taming Code Organization with Module Boundaries in Nx.Submit questions ...
Read more >eslint rule @nrwl/nx/enforce-module-boundaries fails [UPDATE]
Probably a better solution to the paths in compilerOptions of your tsconfig. base. json in the repo root. Then put "allowCircularSelfDependency ...
Read more >nrwl-nx/community - Gitter
Hey guys, I enabled the rule "nx-enforce-module-boundaries". Now I am getting linting error because I do lazy loading of imports in one specific...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You don’t need to introduce the new tag or have new operator. You can simply split it into two constraints. The following behaves as
AND:It does look like a bit of overhead, but the benefit is it gives you granular control and an overview of how tags are connected. Let me know if this works for your use case.
Note: The following logic is not implemented The other variant I see could be (notice inner array acting as AND):
But I’m not convinced this wouldn’t end up being the foot gun.
I used
non-frameworkfor simplicity. In real application, you would never use such tag name. You could usearchitecture:xor something in those lines. But I hope you got the idea - if you bring new dimension (support for framework in your case) to the equation you need to make sure all the projects have an opinion (tag) on how they want to handle it, otherwise your rules will ban them.We usually use
scope:xfor focus (vertical) segmentation andtype:xfor horizontal segmentation (apps, ui-features, libs, utils etc.). Usually all projects within one scope use the same framework, so there is no need for an explicit framework tag.