refactor: expose upcoming-events public api and guard its boundary (WealthLedger/backend#163)
Backend verify / commits (pull_request) Successful in 1m31s
Backend verify / security (pull_request) Successful in 1m2s
Backend verify / verify (pull_request) Successful in 5m45s

This commit is contained in:
2026-11-04 23:23:00 +03:00
parent 07cfd08df9
commit 093b045616
4 changed files with 26 additions and 17 deletions
+23 -15
View File
@@ -15,6 +15,18 @@ import globals from 'globals';
import tseslint from 'typescript-eslint';
const tests = ['**/*.spec.ts', 'test/**/*.ts'];
const guardedModules = [
{
name: 'tbank-sync',
except: [
'./tbank-sync.api.ts',
'./tbank-sync.dto.ts',
'./tbank-sync.module.ts',
'./tbank-sync-repository.module.ts',
],
},
{ name: 'upcoming-events', except: ['./upcoming-events.api.ts', './upcoming-events.module.ts'] },
];
const prismaImports = [
'@prisma/*', '**/generated/prisma/**', '**/prisma.service',
];
@@ -213,24 +225,20 @@ export default defineConfig(
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
},
},
{
files: ['src/**/*.ts'],
ignores: [...tests, 'src/modules/investments/tbank-sync/**'],
// Separate rule so it does not replace layer-specific no-restricted-imports configs.
// A module may import its own internals, so each guarded module gets a block without its zone.
...[undefined, ...guardedModules].map((own) => ({
files: own ? [`src/modules/investments/${own.name}/**/*.ts`] : ['src/**/*.ts'],
ignores: own ? tests : [...tests, ...guardedModules.map(({ name }) => `src/modules/investments/${name}/**`)],
rules: {
// Separate rule so it does not replace layer-specific no-restricted-imports configs.
'import-x/no-restricted-paths': ['error', {
zones: [{
zones: guardedModules.filter((module) => module !== own).map(({ except, name }) => ({
target: './src',
from: './src/modules/investments/tbank-sync',
except: [
'./tbank-sync.api.ts',
'./tbank-sync.dto.ts',
'./tbank-sync.module.ts',
'./tbank-sync-repository.module.ts',
],
message: 'Use tbank-sync.api for cross-module access.',
}],
from: `./src/modules/investments/${name}`,
except,
message: `Use ${name}.api for cross-module access.`,
})),
}],
},
},
})),
);