import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import svelte from 'eslint-plugin-svelte';
import prettier from 'eslint-config-prettier';
import svelteConfig from './svelte.config.js';

export default [
    {
        ignores: [
            '.svelte-kit/**',
            'dist/**',
            'build/**',
            'node_modules/**',
            'site/**',
            'static/**',
            'build.mjs',
            'playwright-report/**',
        ],
    },
    js.configs.recommended,
    ...tseslint.configs.recommended,
    ...svelte.configs['flat/recommended'],
    prettier,
    {
        files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
        languageOptions: {
            parserOptions: {
                parser: tseslint.parser,
                projectService: true,
                extraFileExtensions: ['.svelte'],
                svelteConfig,
            },
        },
    },
    {
        files: ['**/*.mjs', 'build.mjs'],
        languageOptions: { globals: { console: 'readonly', process: 'readonly' } },
    },
    {
        rules: {
            'svelte/no-at-html-tags': 'warn',
            'svelte/require-each-key': 'off',
            'svelte/no-navigation-without-resolve': 'off',
        },
    },
];
