const nx = require('@nx/eslint-plugin');
const eslintConfigPrettier = require('eslint-config-prettier/flat');

module.exports = [
  ...nx.configs['flat/base'],
  ...nx.configs['flat/typescript'],
  ...nx.configs['flat/javascript'],
  {
    ignores: [
      '**/dist',
      '**/vite.config.*.timestamp*',
      '**/vitest.config.*.timestamp*',
      '**/generated/**',
    ],
  },
  // {
  //   files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
  //   rules: {
  //     '@nx/enforce-module-boundaries': [
  //       'error',
  //       {
  //         enforceBuildableLibDependency: true,
  //         allow: ['^.*/eslint(\\.base)?\\.config\\.[cm]?js$'],
  //         depConstraints: [
  //           {
  //             sourceTag: '*',
  //             onlyDependOnLibsWithTags: ['*'],
  //           },
  //         ],
  //       },
  //     ],
  //   },
  // },
  {
    files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
  },
  {
    files: ['**/*.json'],
    rules: {
      '@nx/dependency-checks': [
        'error',
        {
          ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs}'],
        },
      ],
    },
    languageOptions: {
      parser: require('jsonc-eslint-parser'),
    },
  },
  eslintConfigPrettier,
];
