Messenger/packages/backend/eslint.config.mjs
Заид Омар Медхат | Zaid Omar Medhat 62f20f8843 init
2026-07-10 13:31:12 +05:00

45 lines
1.4 KiB
JavaScript

import { base } from '../../eslint.config.mjs';
import boundaries from 'eslint-plugin-boundaries';
// Backend architecture layering. The folder-based layers are classified and the
// import direction between them is enforced:
// routes → may import plugins, db
// plugins → may import db
// db → leaf (types only)
// (src/app.ts, src/server.ts, src/config.ts are the composition root + leaf
// config — unclassified in Phase 0.) The full per-domain module structure with
// route → service → repository layering is introduced in Phase 1.
export default [
{ ignores: ['dist/**', 'migrations/**'] },
...base,
{
files: ['src/**/*.ts'],
plugins: { boundaries },
settings: {
'boundaries/include': ['src/**/*'],
'boundaries/elements': [
{ type: 'plugins', pattern: 'src/plugins/*' },
{ type: 'routes', pattern: 'src/routes/*' },
{ type: 'db', pattern: 'src/db/*' },
],
},
rules: {
'boundaries/dependencies': [
'error',
{
default: 'disallow',
policies: [
{
from: { element: { types: 'routes' } },
allow: { to: { element: { types: { anyOf: ['plugins', 'db'] } } } },
},
{
from: { element: { types: 'plugins' } },
allow: { to: { element: { types: 'db' } } },
},
],
},
],
},
},
];