eslint.config.js (1381B)
1 import { loadConfig } from '@sveltejs/load-config'; 2 import js from '@eslint/js'; 3 import ts from 'typescript-eslint'; 4 import svelte from 'eslint-plugin-svelte'; 5 import { defineConfig } from 'eslint/config'; 6 7 const svelteConfig = (await loadConfig('./', { traverse: false }))?.config; 8 if (!svelteConfig) throw new Error('Missing Svelte configuration'); 9 10 export default defineConfig( 11 { 12 ignores: [ 13 'node_modules/**', 14 '.svelte-kit/**', 15 'build/**', 16 'test-results/**', 17 'playwright-report/**' 18 ] 19 }, 20 js.configs.recommended, 21 ts.configs.recommended, 22 { 23 files: ['**/*.ts', '**/*.svelte'], 24 extends: [ts.configs.recommendedTypeChecked], 25 languageOptions: { 26 parserOptions: { projectService: true, extraFileExtensions: ['.svelte'] } 27 } 28 }, 29 svelte.configs.recommended, 30 svelte.configs.prettier, 31 { 32 files: ['src/lib/components/CapabilityGate.svelte'], 33 languageOptions: { globals: { document: 'readonly' } } 34 }, 35 { 36 files: ['**/*.svelte'], 37 languageOptions: { parserOptions: { parser: ts.parser, svelteConfig } }, 38 rules: { 'svelte/no-inline-styles': 'error' } 39 }, 40 { 41 files: ['**/*.js', '**/*.mjs'], 42 languageOptions: { 43 globals: { 44 console: 'readonly', 45 process: 'readonly', 46 URL: 'readonly', 47 Buffer: 'readonly', 48 TextDecoder: 'readonly' 49 } 50 } 51 } 52 );