GithubHelp home page GithubHelp logo

codelytv / eslint-plugin-hexagonal-architecture Goto Github PK

View Code? Open in Web Editor NEW
282.0 7.0 16.0 206 KB

A plugin that helps you to enforce hexagonal architecture best practises

Home Page: https://www.npmjs.com/package/eslint-plugin-hexagonal-architecture

License: GNU Affero General Public License v3.0

JavaScript 1.61% TypeScript 98.39%
eslint eslint-plugin hexagonal hexagonal-architecture javascript typescript

eslint-plugin-hexagonal-architecture's Introduction

🎯 Codely's ESLint Hexagonal Architecture plugin

Codely Open Source CodelyTV Courses

A plugin that helps you to enforce hexagonal architecture best practises. Valid for your JavaScript or TypeScript projects 🤟 Stars are welcome 😊

🤔 What it does

  • Enforce conventional folder naming: only domain, application and infrastructure are valid folder names (under the glob pattern you specify)
  • Prevent imports from restricted layers:
    • domain can only import files from the same folder
    • application can only import from application and domain
    • infrastructure can import from application, domain and infrastructure

hexagonal-dependency-rule

👀 How to use

  1. Install the dependency
    npm install --save-dev eslint-plugin-hexagonal-architecture
  2. Add the plugin to your .eslintrc.js file:
    {
      plugins: ["hexagonal-architecture"],
    }
  3. Enable the rule for the specific folders that will contain your logic using ESLint's Glob Patterns overrides:
    {
      overrides: [
        {
          files: ["contexts/{backend,frontend}/*/src/**/*.ts"],
          rules: {
            "hexagonal-architecture/enforce": ["error"],
          },
        },
      ]
    }

👌 Codely Code Quality Standards

Publishing this package we are committing ourselves to the following code quality standards:

  • 🤝 Respect Semantic Versioning: No breaking changes in patch or minor versions
  • 🤏 No surprises in transitive dependencies: Use the bare minimum dependencies needed to meet the purpose
  • 🎯 One specific purpose to meet without having to carry a bunch of unnecessary other utilities
  • ✅ Tests as documentation and usage examples
  • 📖 Well documented ReadMe showing how to install and use
  • ⚖️ License favoring Open Source and collaboration

🔀 Related resources

Opinionated skeletons ready for different purposes:

eslint-plugin-hexagonal-architecture's People

Contributors

nuria-fl avatar rgomezcasas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

eslint-plugin-hexagonal-architecture's Issues

Missleading naming of this plugin (Not Hexagonal architecture)

Hello.
The name of this plugin can lead many to believe, that this has something to do with Hexagonal architecture and might promote a false premise, that Hexagonal architecture has something to do with number of layers and their structure in your Application core, which it really does not.

Hexagonal architecture is originally named ports and adapters architecture, because its main premise is that you hide parts of the application, ussially technology specific (UI, DB, CLI) and technology agnostic code (Application core) respectively, behind "ports". Additionally Hexagonal architecture usually splits into 3 parts. Driven part, Application core and Driving part. Driving part initiates interaction, calls Application core through a port and that then may or may not call Driven port to get data or anything else.

It does not tell you much or anything about how to structure Application core (that is btw why it pairs well with architectures aimed at structuring the domain related code like DDD).

I suggest adding at least a note, that this does not reflect the architecture and its main principle, but rather enforces opinionated folder structure inspired by hexagonal architecture.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.