import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import globals from 'globals';

// Flat config (ESLint 9). Real linting — replaces the previous no-op `echo`.
// Correctness rules from the recommended sets stay errors and fail CI;
// stylistic/known-pattern rules are relaxed so the current tree is clean.
export default tseslint.config(
  { ignores: ['dist/**', 'coverage/**', 'node_modules/**'] },
  js.configs.recommended,
  ...tseslint.configs.recommended,
  {
    files: ['**/*.{ts,mts,cts}'],
    languageOptions: {
      globals: { ...globals.node },
    },
    rules: {
      // Fastify request/reply are cast to `any` at framework boundaries.
      '@typescript-eslint/no-explicit-any': 'off',
      // Surface dead code without failing the build on work-in-progress.
      '@typescript-eslint/no-unused-vars': [
        'warn',
        { argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrors: 'none' },
      ],
    },
  },
);
