1.11.2 • Published 5 months ago

eslint-plugin-feature-sliced-design v1.11.2

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

eslint-plugin-feature-sliced-design

An ESLint plugin for enforcing best practices of the Feature-Sliced Design methodology in your project.

Installation

npm install --save-dev eslint-plugin-feature-sliced-design

Usage

Add feature-sliced-design to the plugins section of your ESLint configuration:

{
  "plugins": ["feature-sliced-design"],
  "rules": {
    "feature-sliced-design/layers-hierarchy": [
      "error",
      {
        "alias": "@",
        "projectDir": "src"
      }
    ],
    "feature-sliced-design/public-api-slice-import": [
      "error",
      {
        "alias": "@",
        "projectDir": "src",
        "ignoreLayers": ["shared", "app"],
        "insideProjectOnly": false
      }
    ],
    "feature-sliced-design/relative-path-within-slice": [
      "error",
      { 
        "alias": "@",
        "projectDir": "src"
      }
    ]
  }
}

Rules

feature-sliced-design/layers-hierarchy

Enforces the correct import hierarchy based on Feature-Sliced Design principles.

More detailed description

feature-sliced-design/public-api-slice-import

Enforces that slices can only be imported via their public API.

More detailed description

feature-sliced-design/relative-path-within-slice

Ensures that all imports within a slice use relative paths instead of absolute aliases.

More detailed description

Configuration Options

  • alias: The alias used for imports (e.g., @). No alias by default.
  • projectDir: The root directory of your frontend project. src by default.
  • ignoreLayers (for public-api-slice-import): Layers that should be ignored in rule enforcement.
  • insideProjectOnly (for public-api-slice-import): If true, it's allowed to import from non-public API in files outside project directory.

License

ISC

1.11.2

5 months ago

1.11.1

5 months ago

1.11.0

5 months ago

1.8.2

2 years ago

1.9.0

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.8.3

2 years ago

1.10.0

2 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago