sheriff: Cannot ignore shared module
I am trying to gradually introduce sherriff into a large scale project. After finishing the setup I added a single index.ts
in one module (admin directory) and set up a very simple config with just one module definition:
export const sheriffConfig: SheriffConfig = {
version: 1,
tagging: {
'src/app/admin': ['domain:admin']
},
depRules: {
'domain:admin': ['domain:admin']
}
};
My expectation was to only get error messages related to this module. However, a lot of errors are thrown regarding the relation to the Shared module. The Shared module has no index.ts (yet) so I was expecting Sherriff to ignore it. What am I missing or misunderstanding? This makes gradually introducing the tool very hard.
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 17 (8 by maintainers)
@fynnfeldpausch Would that help?
Yup, I think we understand each other. Sheriff defines an artificial module for all your code, which is not behind a barrel file. And that’s module
root
. So if you get an option to disableroot
, you have a working solution for your migration.Sounds great. I will also give it some more thoughts and tests in the upcoming days and will call it a day for now.
Many thanks for your immediate help 👏🙏
OK, I think I understand. The
root
module acts as an implicit module. What you want is that it isn’t a module at all.All files from your admin module should be able to import from
root
whatever they want. And if a file ofroot
has a dependency onadmin
, it has to be done via theindex.ts
. Right?Let me think about it. Right now, I think the easiest solution is an option where you can disable the
root
module to simplify the transition.