0.1.0-beta.15 • Published 7 months ago

eslint-plugin-layered-import v0.1.0-beta.15

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

eslint-plugin-layered-import

Enforced layered architecture by checking import statements

In a typical project, the source code is organized into various layers, such as components and pages. It's considered good practice for code under the pages folder (high-level modules) to depend on code under the components folder (low-level modules), but not the other way around.

This ESLint plugin offers an easy way to enforce this layered architecture within a single repository.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-layered-import:

npm install eslint-plugin-layered-import --save-dev

Usage

Add layered-import to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": [
    "layered-import"
  ]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "layered-import/wrong-import-layer": [
      "warn",
      {
        "layerConfigs": [
          { "layer": 1, "pattern": "components/**" },
          { "layer": 2, "pattern": "pages/**" },
        ],
      },
    ],
  }
}

Rules

NameDescription
wrong-import-layerWrong import layer
0.1.0-beta.15

7 months ago

0.1.0-beta.14

7 months ago

0.1.0-beta.13

7 months ago

0.1.0-beta.12

7 months ago

0.1.0-beta.11

7 months ago

0.1.0-beta.10

7 months ago

0.1.0-beta.9

7 months ago

0.1.0-beta.8

7 months ago

0.1.0-beta.7

7 months ago

0.1.0-beta.6

7 months ago

0.1.0-beta.5

7 months ago

0.1.0-beta.4

7 months ago

0.1.0-beta.3

7 months ago

0.1.0-beta.2

7 months ago

0.1.0-beta.1

7 months ago

0.1.0-beta.0

7 months ago