Skip to content

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

Open
@illright

Description

@illright

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    PRIORITY | LOWCan wait until after releasefixableRules whose issues the linter can fix automatically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions