|
| 1 | +import js from '@eslint/js'; |
| 2 | +import ts from '@typescript-eslint/eslint-plugin'; |
| 3 | +import tsParser from '@typescript-eslint/parser'; |
| 4 | +import svelte from 'eslint-plugin-svelte'; |
| 5 | +import svelteParser from 'svelte-eslint-parser'; |
| 6 | +import globals from 'globals'; |
| 7 | + |
| 8 | +/** @type {import('eslint').Linter.Config[]} */ |
| 9 | +export default [ |
| 10 | + js.configs.recommended, |
| 11 | + { |
| 12 | + languageOptions: { |
| 13 | + globals: { ...globals.browser, ...globals.node }, |
| 14 | + }, |
| 15 | + rules: { |
| 16 | + 'no-unused-vars': ['error', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }], |
| 17 | + }, |
| 18 | + }, |
| 19 | + { |
| 20 | + files: ['**/*.ts'], |
| 21 | + languageOptions: { |
| 22 | + parser: tsParser, |
| 23 | + globals: { ...globals.browser, ...globals.node }, |
| 24 | + }, |
| 25 | + plugins: { '@typescript-eslint': ts }, |
| 26 | + rules: { |
| 27 | + ...ts.configs.recommended.rules, |
| 28 | + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], |
| 29 | + '@typescript-eslint/no-explicit-any': 'warn', |
| 30 | + }, |
| 31 | + }, |
| 32 | + { |
| 33 | + files: ['**/*.svelte'], |
| 34 | + languageOptions: { |
| 35 | + parser: svelteParser, |
| 36 | + parserOptions: { parser: tsParser }, |
| 37 | + globals: { ...globals.browser }, |
| 38 | + }, |
| 39 | + plugins: { svelte }, |
| 40 | + rules: { |
| 41 | + ...svelte.configs.recommended.rules, |
| 42 | + // Svelte 5 runes pattern — initialising state from page data is intentional |
| 43 | + 'svelte/valid-compile': ['warn', { ignoreWarnings: true }], |
| 44 | + // a11y covered by svelte-check, not needed here |
| 45 | + 'svelte/no-unused-svelte-ignore': 'warn', |
| 46 | + }, |
| 47 | + }, |
| 48 | + { |
| 49 | + files: ['**/*.d.ts'], |
| 50 | + rules: { '@typescript-eslint/no-empty-object-type': 'off' }, |
| 51 | + }, |
| 52 | + { |
| 53 | + ignores: ['.svelte-kit/**', 'build/**', 'node_modules/**'], |
| 54 | + }, |
| 55 | +]; |
0 commit comments