# eslint-plugin-layered-import

> Enforced layered architecture by checking import statements

Latest version **0.1.0-beta.15** (published 2023-10-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-layered-import
pnpm add eslint-plugin-layered-import
yarn add eslint-plugin-layered-import
bun add eslint-plugin-layered-import
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0-beta.15 |
| Published | 2023-10-30 |
| First published | 2023-10-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^14.17.0 \|\| ^16.0.0 \|\| >= 18.0.0 |
| Dependencies | 1 |
| Unpacked size | 16.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tony Nie |
| Maintainers | cfvbaibai |
| Keywords | eslint, eslintplugin, eslint-plugin |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-layered-import
- npm.io page: https://npm.io/package/eslint-plugin-layered-import

## Dependencies (1)

- [requireindex](https://npm.io/package/requireindex.md) ^1.2.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 0.1.0-beta.15 (latest) — 2023-10-30
- 0.1.0-beta.14 — 2023-10-30
- 0.1.0-beta.13 — 2023-10-30
- 0.1.0-beta.12 — 2023-10-30
- 0.1.0-beta.11 — 2023-10-30
- 0.1.0-beta.10 — 2023-10-30
- 0.1.0-beta.9 — 2023-10-30
- 0.1.0-beta.8 — 2023-10-30
- 0.1.0-beta.7 — 2023-10-30
- 0.1.0-beta.6 — 2023-10-30
- 0.1.0-beta.5 — 2023-10-30
- 0.1.0-beta.4 — 2023-10-30
- 0.1.0-beta.3 — 2023-10-30
- 0.1.0-beta.2 — 2023-10-30
- 0.1.0-beta.1 — 2023-10-30
- … 1 more at https://npm.io/package/eslint-plugin-layered-import/versions

## README

# 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](https://eslint.org/):

```sh
npm i eslint --save-dev
```

Next, install `eslint-plugin-layered-import`:

```sh
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:

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

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

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

## Rules

<!-- begin auto-generated rules list -->

| Name                                                   | Description        |
| :----------------------------------------------------- | :----------------- |
| [wrong-import-layer](docs/rules/wrong-import-layer.md) | Wrong import layer |

<!-- end auto-generated rules list -->

---
_Source: https://npm.io/package/eslint-plugin-layered-import · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
