Awesome
<p align="center"> <a href="https://codely.com"> <img src="https://user-images.githubusercontent.com/10558907/170513882-a09eee57-7765-4ca4-b2dd-3c2e061fdad0.png" width="300px" height="92px"/> </a> </p> <h1 align="center"> π― Codely's ESLint Hexagonal Architecture plugin </h1> <p align="center"> <a href="https://github.com/CodelyTV"><img src="https://img.shields.io/badge/CodelyTV-OS-green.svg?style=flat-square" alt="Codely Open Source"/></a> <a href="https://pro.codely.com"><img src="https://img.shields.io/badge/CodelyTV-PRO-black.svg?style=flat-square" alt="CodelyTV Courses"/></a> </p> <p align="center"> A plugin that helps you to enforce hexagonal architecture best practises. Valid for your JavaScript or TypeScript projects π€ <a href="https://github.com/CodelyTV/eslint-plugin-hexagonal-architecture/stargazers">Stars are welcome π</a> </p>π€ What it does
- Enforce conventional folder naming: only
domain
,application
andinfrastructure
are valid folder names (under the glob pattern you specify) - Prevent imports from restricted layers:
domain
can only import files from the same folderapplication
can only import fromapplication
anddomain
infrastructure
can import fromapplication
,domain
andinfrastructure
π How to use
- Install the dependency
npm install --save-dev eslint-plugin-hexagonal-architecture
- Add the plugin to your
.eslintrc.js
file:{ plugins: ["hexagonal-architecture"], }
- 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
- π¦ Linting en JavaScript y TypeScript: Used as a template to bootstrap this plugin
- π€ Codely's ESLint + Prettier configuration: Opinionated linting configuration considering modern TypeScript best practices and providing consistency to your import statements. Valid for your JavaScript or TypeScript projects
Opinionated skeletons ready for different purposes: