import {FlatCompat} from '@eslint/eslintrc';
import js from '@eslint/js';
import {dirname} from 'path';
import {fileURLToPath} from 'url';

import baseConfig from '../../eslint.config.mjs';


const compat = new FlatCompat({
  baseDirectory: dirname(fileURLToPath(import.meta.url)),
  recommendedConfig: js.configs.recommended,
});

export default [
  {
    ignores: ['**/dist'],
  },
  ...baseConfig,
  ...compat
    .config({
      extends: [
        'plugin:@nx/angular',
        'plugin:@angular-eslint/template/process-inline-templates',
      ],
    })
    .map((config) => ({
      ...config,
      files: ['**/*.ts'],
      rules: {
        ...config.rules,
        '@angular-eslint/directive-selector': [
          'error',
          {
            type: 'attribute',
            prefix: 'apollusiaNx',
            style: 'camelCase',
          },
        ],
        '@typescript-eslint/no-empty-function': 'off',
        '@angular-eslint/no-empty-lifecycle-method': 'off',
        '@angular-eslint/prefer-standalone': 'off',
      },
    })),
  ...compat
    .config({
      extends: ['plugin:@nx/angular-template'],
    })
    .map((config) => ({
      ...config,
      files: ['**/*.html'],
      rules: {
        ...config.rules,
      },
    })),
];
