-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nx-enforce-module-boundaries restrict importing react in libs #6727
Comments
Hey! This is an interesting suggestion 👍. In the meantime, you can always add react to the no-restricted-imports eslint rule in each library's eslintrc file (https://eslint.org/docs/rules/no-restricted-imports) |
is negating this possible? as in:
and then allowing it
Essentially... I don't want any util libs to use this external lib, but I do have a specific instance where it needs to be allowed, and it's anything in |
@mlebarron the short answer is - No, unfortunately not. The way dependency constraints work is that they are combined using AND. This means that your example would be translated to:
Although scope would allow it, the type util would ban it, resulting in banned import. If one of your |
@meeroslav Yeah that's why I was asking, just wanted to confirm. We happen to have a case where we have a legacy library that we don't want to allow basically anything in the new codebase to use except where absolutely necessary, until it's phased out. We actually discussed redoing the tag structure but figured it wasn't worth it just to accommodate one lib. We're using I didn't give the greatest sample, so it made less sense than if I actually put the library names and full setup :) |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Description
I have some libraries that are dependent on React and other libraries that are just utils.
I would like to restrict importing of React in libraries that are just utils.
I am not exactly sure how this would look, but something like this would be handy
The text was updated successfully, but these errors were encountered: