The project uses a flat configuration file (eslint.config.js) that integrates ESLint with TypeScript, Svelte, and Prettier. It is configured to recognize .svelte files and uses the project's svelte.config.js for parsing.
Key configuration features include:
- Recommended Rules: Includes recommended configurations for JavaScript, TypeScript, and Svelte.
- Prettier Integration: Uses
eslint-config-prettier and svelte.configs.prettier to disable ESLint rules that conflict with Prettier. - Global Variables: Configures both
browser and node environments. - Svelte Parsing: Specifically targets
**/*.svelte, **/*.svelte.ts, and **/*.svelte.js files, utilizing typescript-eslint as the parser and passing the local svelteConfig to the parser options.
import prettier from 'eslint-config-prettier';
import js from '@eslint/js';
import { includeIgnoreFile } from '@eslint/compat';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import ts from 'typescript-eslint';
import svelteConfig from './svelte.config.js';
export default ts.config(
includeIgnoreFile(gitignorePath),
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs.recommended,
prettier,
...svelte.configs.prettier,
{
languageOptions: {
globals: { ...globals.browser, ...globals.node }
},
rules: { 'no-undef': 'off' }
},
{
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
languageOptions: {
parserOptions: {
projectService: true,
extraFileExtensions: ['.svelte'],
parser: ts.parser,
svelteConfig
}
}
}
);