feature-sliced / steiger

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

Bug: no-segmentless-slices with non-standard naming #44

Open EliseyMartynov opened 3 months ago

EliseyMartynov commented 3 months ago

У нас на проекте нейминг сегментов использует в angular-like стиль:

cart.ui.tsx
cart.model.ts
cart.lib.ts
...

В некоторых местах где нет отдельных папок вроде 'ui', 'lib', и .тд. линтер ругается на то, что слайс без сегментов - что неверно.

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

illright commented 3 months ago

Yeah, these cases might be hard to catch, though this is technically non-standard FSD. How would you see a solution to support such cases?

EliseyMartynov commented 3 months ago

Again, there are no hard restrictions to use segment-naming like that in the documentation. Segment part was always team-oriented thing. E.g. our team uses "complicated" segments, where segment can contain its own sub-segments:

features
└─ slice
       └─ ui
              └─ segment-one
                     └─ index.ts
                     └─ segment-one.ui.tsx
                     └─ segment-one.model.ts 
              └─ segment-two.ui.tsx 

So I would suggest to process this cases out of the box (it could be some regex, and it's not crashing default behavior).

uskov-anton commented 3 months ago

I suggest adding the ability for users to specify the relationship between the segment type and the regexp in the settings.

Leave the current option as default.