A plugin that helps you to enforce hexagonal architecture best practises.
npm install eslint-plugin-hexagonal-architecture
A plugin that helps you to enforce hexagonal architecture best practises. Valid for your JavaScript or TypeScript projects π€
Stars are welcome π
- 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

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