feature-sliced / steiger

Universal file structure and project architecture linter
https://www.npmjs.com/package/steiger
MIT License
48 stars 3 forks source link

Add an exception for an index file inside the App layer #55

Closed daniilsapa closed 1 month ago

daniilsapa commented 1 month ago

Right now it reports an error on such a case. But it looks like it should not, because the app layer is the entry point to your application, and it's pretty intuitive that it could have an index.js/ts file.

Screenshot 2024-07-13 at 23 35 16
illright commented 1 month ago

Why not app/entrypoint?

daniilsapa commented 1 month ago

@illright Just my personal opinion on this point.

1. How do the users usually name their entry point file?

I reviewed examples from FSD examples page to see what people usually use.

The results are:

So, the users tend to have index files there.

2. Unnecessary limitation

I understand that an architectural approach for software is partially about well-thought restrictions that you create for yourself that help you structure things. But I personally believe that restrictions should be applied where they are critical, and should not create additional headaches where they are absolutely unnecessary.

3. Resistance to integration

When you see an error from your linter, it takes time to understand what is wrong and why. Then you need to decide what to do. In the case we’re discussing, it can be renaming the file or disabling the rule.

This project is still in its early stages so far and I think it is worth reducing resistance to integration as much as possible and the number of such small headaches to a minimum to grow the user base quicker. The more such small things that can annoy users the more chance that another such a small thing can be the last straw where a user decides to abandon/disable the tool.

If this still doesn't sound convincing, feel free to close the issue.

illright commented 1 month ago

No, these are good points. Besides, this is not the first time we make exceptions for the App layer. I'm convinced, we can add this exception. Feel free to make another PR :)

daniilsapa commented 1 month ago

Got it, sure, I'll add logic to handle this exception and make a PR soon 👌