at main 1.7 kB view raw
1import js from '@eslint/js'; 2import tsParser from '@typescript-eslint/parser'; 3import tsPlugin from '@typescript-eslint/eslint-plugin'; 4import sveltePlugin from 'eslint-plugin-svelte'; 5import svelteParser from 'svelte-eslint-parser'; 6 7export default [ 8 { 9 ignores: [ 10 '.svelte-kit/**', 11 '.vercel/**', 12 'build/**', 13 'node_modules/**', 14 'dist/**', 15 '**/*.config.js' 16 ] 17 }, 18 js.configs.recommended, 19 { 20 files: ['**/*.ts', '**/*.svelte'], 21 languageOptions: { 22 parser: tsParser, 23 parserOptions: { 24 project: './tsconfig.json', 25 extraFileExtensions: ['.svelte'] 26 }, 27 globals: { 28 // browser globals 29 window: 'readonly', 30 document: 'readonly', 31 console: 'readonly', 32 fetch: 'readonly', 33 localStorage: 'readonly', 34 sessionStorage: 'readonly', 35 setTimeout: 'readonly', 36 clearTimeout: 'readonly', 37 alert: 'readonly', 38 confirm: 'readonly', 39 navigator: 'readonly', 40 location: 'readonly', 41 history: 'readonly', 42 crypto: 'readonly', 43 // svelte 5 runes 44 $state: 'readonly', 45 $derived: 'readonly', 46 $effect: 'readonly', 47 $props: 'readonly', 48 $bindable: 'readonly', 49 $inspect: 'readonly' 50 } 51 }, 52 plugins: { 53 '@typescript-eslint': tsPlugin 54 }, 55 rules: { 56 'no-unused-vars': 'off', 57 '@typescript-eslint/no-unused-vars': [ 58 'error', 59 { 60 argsIgnorePattern: '^_', 61 varsIgnorePattern: '^_', 62 caughtErrors: 'none' 63 } 64 ] 65 } 66 }, 67 { 68 files: ['**/*.svelte'], 69 languageOptions: { 70 parser: svelteParser, 71 parserOptions: { 72 parser: tsParser 73 } 74 }, 75 plugins: { 76 svelte: sveltePlugin 77 }, 78 rules: { 79 ...sveltePlugin.configs.recommended.rules 80 } 81 } 82];