feature-sliced / steiger

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

Implement auto-fixes for `no-public-api-sidestep` #4

Open illright opened 5 months ago

illright commented 5 months ago

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

illright commented 4 months ago

The autofix is lower priority