Support ~"doesNotHaveSourceTag" functionality in module boundary constraints #35436
npyianilos
started this conversation in
Feature Requests
Replies: 2 comments
-
|
By the way, I would be willing to propose exact syntax / pull request, if we decide this can be supported somehow |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
It looks like the main change would be in runtime-lint-utils.ts#findConstraintsFor. Something like: { withoutSourceTag: "module:foo:*", notDependOnLibsWithTags: ["module:foo:private"] } else if (isNegativeDepConstraint(f)) { |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
My understanding, and I could be wrong, is that #14982 was supposed to address
#14173 by allowing negative regular expressions, like this, as @meeroslav said:
{
"sourceTag": "/^(?!scope:example)/",
"notDependOnLibsWithTags": ["scope:example"]
},
The reason I think this doesn't actually solve the problem, is that the constraint applies if ANY of the package's tags match the regexp.
When I tried this, I learned, that Nx injects a "npm:private" tag by default? So in that case, the above condition will ALWAYS be true, because every project will have at least one tag not matching "scope:example"
Even without that default "npm:private" tag, the current functionality doesn't allow you to have more than one tag.
So currently, using negated regexes says "enforce this constraint if a package has ANY tag not matching the regexp"
What is desired is "enforce if NONE of the package's tags match this regexp"
Use case: modular monolith:
Beta Was this translation helpful? Give feedback.
All reactions