1.0.2 • Published 2 years ago

eslint-plugin-onion-imports v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

eslint-plugin-onion-imports

CI

This plugin helps to enforce import constraints according to the Onion Architecture.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-onion-imports:

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:

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

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

{
  "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

License

MIT