# eslint-plugin-onion-imports

> Enforce import rules for Onion Architecture

Latest version **1.0.2** (published 2022-06-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-onion-imports
pnpm add eslint-plugin-onion-imports
yarn add eslint-plugin-onion-imports
bun add eslint-plugin-onion-imports
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-06-30 |
| First published | 2022-06-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=16 |
| Dependencies | 1 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michael Schertenleib |
| Maintainers | cravay |
| Keywords | eslint, eslintplugin |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-onion-imports
- Repository: https://github.com/cravay/eslint-plugin-onion-imports
- Homepage: https://github.com/cravay/eslint-plugin-onion-imports#readme
- Issues: https://github.com/cravay/eslint-plugin-onion-imports/issues
- npm.io page: https://npm.io/package/eslint-plugin-onion-imports

## Dependencies (1)

- [ignore](https://npm.io/package/ignore.md) ^5.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

- 1.0.2 (latest) — 2022-06-30
- 1.0.1 — 2022-06-29
- 1.0.0 — 2022-06-29

## README

# eslint-plugin-onion-imports

[![CI](https://github.com/cravay/eslint-plugin-onion-imports/actions/workflows/ci.yml/badge.svg)](https://github.com/cravay/eslint-plugin-onion-imports/actions/workflows/ci.yml)

This plugin helps to enforce import constraints according to the [Onion Architecture](https://jeffreypalermo.com/2008/07/the-onion-architecture-part-1/).

## Installation

You'll first need to install [ESLint](https://eslint.org/):

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

Next, install `eslint-plugin-onion-imports`:

```sh
npm install eslint-plugin-onion-imports --save-dev
```

## Usage

Add `onion-imports` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:

```json
{
  "plugins": ["onion-imports"]
}
```

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

```json
{
  "rules": {
    "onion-imports/onion-imports": [
      "warn",
      {
        "layers": [
          [
            { "name": "UI", "patterns": ["src/ui/"] },
            { "name": "Data Access", "patterns": ["src/data-access/"] }
          ],
          { "name": "Business Logic", "patterns": ["src/business-logic/"] },
          { "name": "Object Model", "patterns": ["src/object-model/"] }
        ]
      }
    ]
  }
}
```

## Supported Rules

- [onion-imports](./lib/rules/onion-imports.md)

## License

[MIT](./LICENSE)

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