Skip to content
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

Possibility to define barrel file #36

Open
rainerhahnekamp opened this issue Sep 30, 2023 · 6 comments
Open

Possibility to define barrel file #36

rainerhahnekamp opened this issue Sep 30, 2023 · 6 comments

Comments

@rainerhahnekamp
Copy link
Collaborator

index.ts is the name of the file representing a module.

It should be possible to go with another one. For example, the Angular CLI calls it public-api.ts.

@mikezks: You want to give it a try?

This was referenced Nov 16, 2023
@bradley-carestia-jbh
Copy link

Would love to see this fixed to allow Sherriff to handle cross-entry-point dependencies without having to rename all my public-api files

@KvikullSigurdur
Copy link

KvikullSigurdur commented Nov 4, 2024

I second this Idea but for different reasons. I am working on a large project with a lot of preexisting index.ts files (that don't respect module boundaries) that prevents me from incrementally applying sheriff.

Would be nice to create some barrelIndex.ts that interacts with sheriff while i am cleaning up my codebase.

@rainerhahnekamp
Copy link
Collaborator Author

@KvikullSigurdur just to avoid a misunderstanding. You can have both barrel modules (with an index.tx) and barrel-less in a project.

If you now say that those barrel modules are breaking encapsulation the whole time, then I'd first try to fix that.


That said, I think i don't quite catch the idea of the barrelIndex.ts. What is that one supposed to do? What that be placed next to the index.tsand be used for the "real encapsulation"?

If yes, sheriff.config.ts has a property barrelFileName. Set that one to barrelIndex.ts and Sheriff would ignore index.ts.

Let me know if that works for you

@rainerhahnekamp
Copy link
Collaborator Author

@bradley-carestia-jbh, same goes for you. Just set barrelFileName in sheriff.config.ts to public-api.ts and you're done.

@KvikullSigurdur
Copy link

If you now say that those barrel modules are breaking encapsulation the whole time, then I'd first try to fix that.

Yep that is the goal :) Jump wanted to know if I could somehow enable the warning incrimentally. barrelFileName works perfectly. Thank you very much!

@bradley-carestia-jbh
Copy link

Awesome, I'll give that a try next time I'm looking at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants