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

Bug: Folder name "entity-card/ui" in "shared/ui" is reserved for segment names #46

Open
EliseyMartynov opened this issue Jun 25, 2024 · 7 comments

Comments

@EliseyMartynov
Copy link
Member

Правило: no-reserved-folder-names.
Не совсем понятно что именно тут нарушается.

Sandbox: https://codesandbox.io/p/devbox/steiger-test-g4f4wp

@illright
Copy link
Member

This is a rule that forbids having folders with segment-like names inside segments: https://github.com/feature-sliced/steiger/blob/master/packages/steiger-plugin-fsd/src/no-reserved-folder-names/README.md

For example, you can't have shared -> ❗️ ui -> entity-card -> ❌ ui to avoid confusion

@EliseyMartynov
Copy link
Member Author

But wait.. Segments can be complicated, and entity-card can have their own segment ui just because it can be complicated.
So we can just turn off this rule?

@illright
Copy link
Member

It's true that segments can be complicated, but I don't see how you would need to subdivide to ui if you (theoretically) have already excluded all non-UI code. For instance, for this structure:

  • 📂 shared/ui/complicated-thing/
    • 📂 ui
    • 📂 api // ← this doesn't make sense inside shared/ui

@EliseyMartynov
Copy link
Member Author

It doesn't make sense with api, but make sense with other segments like model (why not)?

@illright
Copy link
Member

but make sense with other segments like model (why not)?

If I'm inside a segment ui, I expect to only find code related to UI, not the data model. The data model has its own segment, model, which is where I'd go to look for that code. So for me, it never makes sense to have segments inside of segments

@EliseyMartynov
Copy link
Member Author

EliseyMartynov commented Jun 26, 2024

Can't accept that. There are plenty UI elements that can have internal state, such as select-box. So where should I place logic? In UI segment?

@illright
Copy link
Member

Not every instance of state needs to be a model. For example, a select box might track the state of selected options, but this is not business logic, so I would simply write that state inside the component, or in a sibling file.

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

2 participants