|
| 1 | +// @ts-check |
| 2 | + |
| 3 | +import eslint from '@eslint/js'; |
| 4 | +import tseslint from 'typescript-eslint'; |
| 5 | +import tsParser from '@typescript-eslint/parser'; |
| 6 | +import eslintPluginSvelte from 'eslint-plugin-svelte'; |
| 7 | +import svelteParser from 'svelte-eslint-parser'; |
| 8 | +import svelteConfig from './svelte.config.js'; |
| 9 | +import globals from 'globals'; |
| 10 | + |
| 11 | +export default tseslint.config( |
| 12 | + eslint.configs.recommended, |
| 13 | + ...tseslint.configs.strict, |
| 14 | + ...tseslint.configs.stylistic, |
| 15 | + ...eslintPluginSvelte.configs['flat/recommended'], |
| 16 | + ...eslintPluginSvelte.configs['flat/prettier'], |
| 17 | + { |
| 18 | + ignores: [ |
| 19 | + '_site/*', |
| 20 | + 'build/*', |
| 21 | + '.svelte-kit/*', |
| 22 | + '.env*', |
| 23 | + '*.js', |
| 24 | + 'static/*.js', |
| 25 | + 'pnpm-lock.yaml', |
| 26 | + 'package-lock.json', |
| 27 | + 'yarn.lock', |
| 28 | + ], |
| 29 | + }, |
| 30 | + { |
| 31 | + rules: { |
| 32 | + '@typescript-eslint/no-empty-function': 'off', |
| 33 | + '@typescript-eslint/no-inferrable-types': 'off', |
| 34 | + '@typescript-eslint/consistent-type-assertions': 'off', |
| 35 | + '@typescript-eslint/no-explicit-any': 'warn', |
| 36 | + '@typescript-eslint/no-unused-vars': [ |
| 37 | + 'error', |
| 38 | + { |
| 39 | + argsIgnorePattern: '^_', |
| 40 | + varsIgnorePattern: '^_', |
| 41 | + caughtErrorsIgnorePattern: '^_', |
| 42 | + }, |
| 43 | + ], |
| 44 | + 'no-unused-vars': 'off', |
| 45 | + indent: ['warn', 2], |
| 46 | + 'linebreak-style': ['error', 'unix'], |
| 47 | + semi: 'warn', |
| 48 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 49 | + }, |
| 50 | + }, |
| 51 | + { |
| 52 | + languageOptions: { |
| 53 | + globals: { |
| 54 | + ...globals.browser, |
| 55 | + }, |
| 56 | + }, |
| 57 | + }, |
| 58 | + { |
| 59 | + languageOptions: { |
| 60 | + parser: tsParser, |
| 61 | + parserOptions: { |
| 62 | + extraFileExtensions: ['.svelte'], |
| 63 | + }, |
| 64 | + }, |
| 65 | + }, |
| 66 | + { |
| 67 | + files: ['**/*.svelte', '*.svelte'], |
| 68 | + languageOptions: { |
| 69 | + parser: svelteParser, |
| 70 | + parserOptions: { |
| 71 | + parser: tsParser, |
| 72 | + svelteConfig, |
| 73 | + }, |
| 74 | + }, |
| 75 | + }, |
| 76 | + { |
| 77 | + files: ['**/*.test.ts'], |
| 78 | + rules: { |
| 79 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 80 | + '@typescript-eslint/no-explicit-any': 'off', |
| 81 | + '@typescript-eslint/no-unused-vars': 'off', |
| 82 | + }, |
| 83 | + } |
| 84 | +); |
0 commit comments