|
| 1 | +import globals from 'globals'; |
| 2 | +import pluginJs from '@eslint/js'; |
| 3 | +import tseslint from 'typescript-eslint'; |
| 4 | +import eslintPluginSvelte from 'eslint-plugin-svelte'; |
| 5 | +import svelteConfig from './svelte.config.js'; |
| 6 | +import eslintConfigPrettier from 'eslint-config-prettier'; |
| 7 | +import * as typescriptParser from '@typescript-eslint/parser'; |
| 8 | + |
| 9 | +/** @type {import('eslint').Linter.Config[]} */ |
| 10 | +export default [ |
| 11 | + { files: ['**/*.{js,mjs,cjs,ts}'] }, |
| 12 | + { languageOptions: { globals: globals.browser } }, |
| 13 | + pluginJs.configs.recommended, |
| 14 | + ...tseslint.configs.recommended, |
| 15 | + ...eslintPluginSvelte.configs['flat/recommended'], |
| 16 | + eslintConfigPrettier, |
| 17 | + { |
| 18 | + ignores: ['dist/', 'node_modules/'], |
| 19 | + }, |
| 20 | + { |
| 21 | + files: ['**/*.svelte', '*.svelte'], |
| 22 | + languageOptions: { |
| 23 | + parserOptions: { |
| 24 | + svelteConfig, |
| 25 | + /** |
| 26 | + * Need these options so eslint can correctly check typescript syntax in .svelte files. |
| 27 | + * |
| 28 | + * @see https://sveltejs.github.io/eslint-plugin-svelte/user-guide/#parser-configuration |
| 29 | + */ |
| 30 | + parser: typescriptParser, |
| 31 | + project: './tsconfig.json', |
| 32 | + extraFileExtensions: ['.svelte'], |
| 33 | + }, |
| 34 | + }, |
| 35 | + }, |
| 36 | + { rules: { '@typescript-eslint/no-unused-vars': 'warn' } }, |
| 37 | +]; |
0 commit comments