0.1.0-beta.15 • Published 2 years ago

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

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years 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

2 years ago

0.1.0-beta.14

2 years ago

0.1.0-beta.13

2 years ago

0.1.0-beta.12

2 years ago

0.1.0-beta.11

2 years ago

0.1.0-beta.10

2 years ago

0.1.0-beta.9

2 years ago

0.1.0-beta.8

2 years ago

0.1.0-beta.7

2 years ago

0.1.0-beta.6

2 years ago

0.1.0-beta.5

2 years ago

0.1.0-beta.4

2 years ago

0.1.0-beta.3

2 years ago

0.1.0-beta.2

2 years ago

0.1.0-beta.1

2 years ago

0.1.0-beta.0

2 years ago