Reference: PublicAPI
Add "@feature-sliced/eslint-config/rules/public-api"
to your extends
section in ESLint config.
// 👎 Fail
import { Issues } from "pages/issues/ui";
import { IssueDetails } from "widgets/issue-details/ui/details"
import { AuthForm } from "features/auth-form/ui/form"
import { Button } from "shared/ui/button/button";
import { saveOrder } from "entities/order/model/actions";
import { orderModel } from "entities/order/model";
import { TicketCard } from "@/entities/ticket/ui";
// 👍 Pass
import { Issues } from "pages/issues";
import { IssueDetails } from "widgets/issue-details"
import { AuthForm } from "features/auth-form"
import { Button } from "shared/ui/button";
import { orderModel } from "entities/order";
import { TicketCard } from "@/entities/ticket";
import { AuthForm } from "features/auth/form"
import { Button } from "shared/ui";
// 👍 Pass
/** @path features/smth/index.ts */
export { SubmitButton, SmthForm } from "./ui";
export * from "./model";
export * as smthModel from "./model";
export { selectSmthById, ... } from "./model";
// 👎 Fail
/** @path features/smth/index.ts */
export { SubmitButton } from "./ui/button";
export { SmthForm } from "./ui/form";
export * from "./model/actions";
export { selectSmthById } from "./model/selectors";
Without SegmentsAPI / InnerAPI restrictions (why experimental?)
Add "@feature-sliced/eslint-config/rules/public-api/lite"
to your extends
section in ESLint config.
Only for @^0.1.0-beta.5
Without changes
// 👍 Pass
import { orderModel } from "entities/order";
// 👎 Fail
import { orderModel } from "entities/order/model";
Less restricted with segments
// 👍 Pass
/** @path features/smth/index.ts */
export { SubmitButton, SmthForm } from "./ui";
export * from "./model";
export * as smthModel from "./model";
export { selectSmthById, ... } from "./model";
// 👍 Also Pass
/** @path features/smth/index.ts */
export { SubmitButton } from "./ui/button";
export { SmthForm } from "./ui/form";
export * from "./model/actions";
export { selectSmthById } from "./model/selectors";
⚠️ DANGEROUS-mode: Support custom segments at shared by_
prefix (why?)Use carefully and at your own risk
import { ... } from "shared/lib" // 🟩 valid import { ... } from "shared/library" // 🟥 not valid import { ... } from "shared/_library" // 🟩 again valid import { ... } from "shared/_library/fp" // 🟩 still valid import { ... } from "shared/_library/fp/compose" // 🟥 don't be brash :)Only for @^0.1.0-beta.6