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