Basic Architecture of Sport Web

This commit is contained in:
Nông Đức Huy
2026-08-11 13:37:25 +07:00
commit 8032fff6ac
262 changed files with 20348 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
import { baseConfig } from './base.js';
/**
* NestJS config.
*
* The two rules that matter architecturally:
* 1. Only the persistence layer may import PrismaService / Redis directly.
* 2. A module must not deep-import another module's internals — cross-module
* access goes through the other module's public surface (`<module>/public`).
*
* @type {import("eslint").Linter.Config[]}
*/
export const nestConfig = [
...baseConfig,
{
files: ['**/*.ts'],
rules: {
/**
* OFF, and it must stay off.
*
* Nest resolves constructor dependencies from `emitDecoratorMetadata`,
* which requires the parameter's type to survive as a *value* import.
* This rule cannot tell an injected class from a pure type, so its
* autofix silently rewrites `import { PrismaService }` into
* `import { type PrismaService }` — which compiles cleanly and then
* fails at runtime with "Nest can't resolve dependencies".
*
* The same reasoning is why `verbatimModuleSyntax` is disabled in
* @sport/config/typescript/nestjs.json.
*/
'@typescript-eslint/consistent-type-imports': 'off',
// Nest relies on parameter decorators and class-based DI.
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'no-console': 'error',
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@/modules/*/*', '!@/modules/*/public'],
message:
'Cross-module deep imports are forbidden. Import from `@/modules/<name>/public` instead.',
},
],
},
],
},
},
{
// Decorated DTO / entity classes legitimately have empty bodies.
files: ['**/*.dto.ts', '**/*.entity.ts'],
rules: { '@typescript-eslint/no-extraneous-class': 'off' },
},
];
export default nestConfig;