-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connect no-segments-on-sliced-layers rule to the app, add documents f…
…or the new rule
- Loading branch information
1 parent
774398b
commit 067634e
Showing
5 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/steiger-plugin-fsd/src/no-segments-on-sliced-layers/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# `no-segmentless-slices` | ||
|
||
Forbid segments that appear in direct children of sliced layers. | ||
|
||
Examples of project structures that pass this rule: | ||
|
||
``` | ||
📂 shared | ||
📂 ui | ||
📄 index.ts | ||
📂 lib | ||
📄 index.ts | ||
📂 entities | ||
📂 user | ||
📂 ui | ||
📂 model | ||
📄 index.ts | ||
📂 pages | ||
📂 home | ||
📂 ui | ||
📄 index.ts | ||
``` | ||
|
||
Examples of project structures that fail this rule: | ||
|
||
``` | ||
📂 shared | ||
📂 ui | ||
📄 index.ts | ||
📂 lib | ||
📄 index.ts | ||
📂 entities | ||
📂 user | ||
📂 ui | ||
📂 model | ||
📄 index.ts | ||
📂 api // ❌ | ||
📄 index.ts | ||
📂 pages | ||
📂 home | ||
📂 ui | ||
📄 index.ts | ||
``` | ||
|
||
## Rationale | ||
|
||
Slices exist to partition code by business domain and entities. You can freely create and name them (e.g. `pages` home, profile and `entities` user, product, ...) based on your needs, application logic, company glossary, etc. Slices contain code of different type/purposes (segments) to implement their part of functionality. Segments (`ui`, `lib`, `api`) are simply a division of code by purpose, thus "ownerless" segments in sliced layers are not allowed since they need to be attached to some part of the business domain inside these layers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters