import { fileURLToPath } from 'node:url'; import { includeIgnoreFile } from '@eslint/compat'; import js from '@eslint/js'; import svelte from 'eslint-plugin-svelte'; import { defineConfig } from 'eslint/config'; import globals from 'globals'; import ts from 'typescript-eslint'; import svelteConfig from './svelte.config.js'; const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url)); // Svelte 5 a11y checking — no separate svelte/a11y-* rules exist in // eslint-plugin-svelte v3.20.0. All a11y validation is built into the // Svelte 5 compiler itself (42 checks covering alt-text, ARIA, keyboard // interaction, semantic HTML, tabindex, roles, labels, etc.). The // svelte/valid-compile rule below surfaces EVERY compiler warning — including // all compiler-level a11y diagnostics — as ESLint errors. // // See node_modules/svelte/src/compiler/warnings.js for the full list of // a11y_* warning codes. No separate eslint-plugin-a11y or jsx-a11y rules // are needed since the Svelte 5 compiler covers them natively. export default defineConfig( includeIgnoreFile(gitignorePath), js.configs.recommended, ...ts.configs.recommended, ...svelte.configs.recommended, { languageOptions: { globals: { ...globals.browser, ...globals.node } } }, { files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'], languageOptions: { parserOptions: { projectService: true, extraFileExtensions: ['.svelte'], parser: ts.parser, svelteConfig } } }, { name: 'svelte:a11y:rules', files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'], rules: { // Surface ALL Svelte 5 compiler warnings as errors — this catches every // built-in a11y check (a11y_missing_attribute, a11y_click_events_have_key_events, // a11y_no_static_element_interactions, a11y_role_has_required_aria_props, // a11y_label_has_associated_control, a11y_media_has_caption, … 42 total). // No warning filter is applied, so every diagnostic is reported. 'svelte/valid-compile': 'error', // Require explicit type attribute on