Open
Description
Restrict imports that go inside the slice, sidestepping the public API.
Every slice (and segment on layers that don't have slices) must contain a public API definition.
Modules outside of this slice/segment can only reference the public API, not the internal file structure of the slice/segment.
https://feature-sliced.design/docs/reference/slices-segments#public-api-rule-on-slices
Examples of imports that violate this rule:
// src/pages/home/ui/HomePage.tsx
import { ArticlePreview } from "~/entities/article/ui/ArticlePreview`;
Pay attention in designing this rule that some people choose to sidestep the public API in Shared, especially shared/ui
, to improve tree-shaking
- Implement the rule
- Implement auto-fixes