You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
eslint-plugin-boundaries does not allow a single file to be of multiple types. For instance, if a file is a service with a pattern like user.service.ts and the same file is in a domain with a pattern like domains/user/**, then this file will either be recognized as a service or as part of the domain but not both at the same type.
In this example, we want to ensure both those conditions:
Repository files can't import service files
Files inside a domain can't import files of another domain. For instance the file person.service.ts should be able to import user.ts, person.repository.ts and login.service.ts, but it should not be able to import planning.service.ts or planning.repository.ts.
I have considered using capturing groups but the fact that files (such as services in my example) could have different patterns (from folder, or based on the extension) makes it hard to correctly capture the nature of the file (ie for this example, either a service or a repository). I know it might be possible, but when you start adding more and more boundaries, it becomes really hard to maintain and adjust them. Moreover, it means, that there is only 1 type defined with a lot of capturing groups which seems to go against the idea of this plugin.
So I would like to avoid this option if possible.
The text was updated successfully, but these errors were encountered:
EtienneTurc
changed the title
Multiple types for a file
[Feature request] Multiple types for a file
Jan 30, 2025
Hi @EtienneTurc ,
Yes, you are right. This is something that I'm thinking about from time ago. I'm planning to create a new major release based on the concept of "tags", so multiple types can be assigned to each file. This would make the plugin much more flexible and powerful, as you have explained. So, I'll let this issue open to track the work of this feature.
Is your feature request related to a problem? Please describe.
eslint-plugin-boundaries
does not allow a single file to be of multiple types. For instance, if a file is a service with a pattern likeuser.service.ts
and the same file is in a domain with a pattern likedomains/user/**
, then this file will either be recognized as a service or as part of the domain but not both at the same type.Why this feature could be useful?
Let's take the following example:
In this example, we want to ensure both those conditions:
person.service.ts
should be able to importuser.ts
,person.repository.ts
andlogin.service.ts
, but it should not be able to importplanning.service.ts
orplanning.repository.ts
.I would like it to work with this configuration:
Describe alternatives you've considered
I have considered using capturing groups but the fact that files (such as services in my example) could have different patterns (from folder, or based on the extension) makes it hard to correctly capture the nature of the file (ie for this example, either a service or a repository). I know it might be possible, but when you start adding more and more boundaries, it becomes really hard to maintain and adjust them. Moreover, it means, that there is only 1 type defined with a lot of capturing groups which seems to go against the idea of this plugin.
So I would like to avoid this option if possible.
The text was updated successfully, but these errors were encountered: