import nx from '@nx/eslint-plugin'; export default [ ...nx.configs['flat/base'], ...nx.configs['flat/typescript'], ...nx.configs['flat/javascript'], { ignores: [ '**/dist', '**/out-tsc', '**/vite.config.*.timestamp*', '**/vitest.config.*.timestamp*', ], }, { files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], rules: { '@nx/enforce-module-boundaries': [ 'error', { enforceBuildableLibDependency: true, allow: ['^.*/eslint(\\.base)?\\.config\\.[cm]?[jt]s$'], depConstraints: [ // ── scope ──────────────────────────────────────────────────────── // api só usa libs api ou shared; web só usa libs web ou shared { sourceTag: 'scope:api', onlyDependOnLibsWithTags: ['scope:api', 'scope:shared'] }, { sourceTag: 'scope:web', onlyDependOnLibsWithTags: ['scope:web', 'scope:shared'] }, // shared não pode importar código de app-scope { sourceTag: 'scope:shared', onlyDependOnLibsWithTags: ['scope:shared'] }, // ── type ───────────────────────────────────────────────────────── // apps só dependem de libs (feature/util/data), nunca de outro app { sourceTag: 'type:app', onlyDependOnLibsWithTags: ['type:feature', 'type:util', 'type:data'], }, // e2e depende do seu app-par e de utils; nunca de outro app { sourceTag: 'type:e2e', onlyDependOnLibsWithTags: ['type:app', 'type:util'], }, // features dependem de features, utils e dados — não de apps { sourceTag: 'type:feature', onlyDependOnLibsWithTags: ['type:feature', 'type:util', 'type:data'], }, // utils são folha — não importam features nem apps { sourceTag: 'type:util', onlyDependOnLibsWithTags: ['type:util', 'type:data'] }, // data é camada mais baixa — só pode depender de outra camada data { sourceTag: 'type:data', onlyDependOnLibsWithTags: ['type:data'] }, ], }, ], }, }, { files: [ '**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts', '**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs', ], // Override or add rules here rules: {}, }, ];