|
| 1 | +import eslintPluginAstro from 'eslint-plugin-astro'; |
| 2 | +import eslintPluginSvelte from 'eslint-plugin-svelte'; |
| 3 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 4 | +import typescriptParser from '@typescript-eslint/parser'; |
| 5 | +import svelteParser from 'svelte-eslint-parser'; |
| 6 | +import eslintConfigPrettier from 'eslint-config-prettier'; |
| 7 | + |
| 8 | +export default [ |
| 9 | + // Ignore patterns |
| 10 | + { |
| 11 | + ignores: ['dist/**', 'node_modules/**', '.astro/**', '.wrangler/**', 'bun.lock', '*.config.js', '*.config.mjs', '*.config.ts'], |
| 12 | + }, |
| 13 | + |
| 14 | + // Base TypeScript configuration |
| 15 | + { |
| 16 | + files: ['**/*.ts', '**/*.tsx'], |
| 17 | + languageOptions: { |
| 18 | + parser: typescriptParser, |
| 19 | + parserOptions: { |
| 20 | + ecmaVersion: 'latest', |
| 21 | + sourceType: 'module', |
| 22 | + project: './tsconfig.json', |
| 23 | + }, |
| 24 | + }, |
| 25 | + plugins: { |
| 26 | + '@typescript-eslint': typescriptEslint, |
| 27 | + }, |
| 28 | + rules: { |
| 29 | + '@typescript-eslint/no-unused-vars': [ |
| 30 | + 'warn', |
| 31 | + { |
| 32 | + argsIgnorePattern: '^_', |
| 33 | + varsIgnorePattern: '^_', |
| 34 | + }, |
| 35 | + ], |
| 36 | + '@typescript-eslint/no-explicit-any': 'warn', |
| 37 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 38 | + '@typescript-eslint/no-non-null-assertion': 'warn', |
| 39 | + }, |
| 40 | + }, |
| 41 | + |
| 42 | + // Astro configuration |
| 43 | + ...eslintPluginAstro.configs.recommended, |
| 44 | + { |
| 45 | + files: ['**/*.astro'], |
| 46 | + rules: { |
| 47 | + // Astro-specific rules |
| 48 | + 'astro/no-set-html-directive': 'error', |
| 49 | + 'astro/no-unused-css-selector': 'warn', |
| 50 | + }, |
| 51 | + }, |
| 52 | + |
| 53 | + // Svelte configuration |
| 54 | + ...eslintPluginSvelte.configs['flat/recommended'], |
| 55 | + { |
| 56 | + files: ['**/*.svelte'], |
| 57 | + languageOptions: { |
| 58 | + parser: svelteParser, |
| 59 | + parserOptions: { |
| 60 | + parser: typescriptParser, |
| 61 | + extraFileExtensions: ['.svelte'], |
| 62 | + }, |
| 63 | + }, |
| 64 | + rules: { |
| 65 | + // Svelte-specific rules |
| 66 | + 'svelte/no-at-html-tags': 'warn', |
| 67 | + 'svelte/no-unused-svelte-ignore': 'warn', |
| 68 | + 'svelte/valid-compile': 'error', |
| 69 | + }, |
| 70 | + }, |
| 71 | + |
| 72 | + // Prettier compatibility (must be last) |
| 73 | + eslintConfigPrettier, |
| 74 | +]; |
0 commit comments