Skip to content

Latest commit

 

History

History

layers-slices

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

@feature-sliced/layers-slices

Usage

Add "@feature-sliced/eslint-config/rules/layers-slices" to your extends section in ESLint config.

// 👎 Fail
// 🛣 features/auth-form/index.ts
import { getRoute } from "pages/auth";
import { getStore } from "app/store";
import { getAuthCtx } from "features/logout";
import { UserAvatar } from "features/viewer-picker";

// 👍 Pass
// 🛣 features/auth-form/index.ts
import { sessionModel } from "entities/session";
import { Form, Button } from "shared/ui";
import { getAuthCtx } from "entities/session";
import { UserAvatar } from "entities/user";

⚠️ DANGEROUS-mode: Support service directories for slices by _ prefix (why?)

Use carefully and at your own risk

import { ... } from "../HomePage";
import { ... } from "../ProfilePage";

// Imported into ...
@path "app/**"                   // 🟩 valid (upper layer)
@path "shared/router"            // 🟥 not valid (lower layer)
@path "pages/CartPage"           // 🟥 not valid (sibling slice)
@path "pages/router"             // 🟥 not valid (sibling slice)
@path "pages/_router"            // 🟩 again valid (as service directory/slice)

But still actual:

@path "pages/_router"
import { ... } from "app"           // 🟥 not valid (lower layer)

@path "shared/lib"
import { ... } from "pages/_router" // 🟥 not valid (lower layer)

Only for @^0.1.0-beta.6