From f8e2f64316354b36099a01eef0735ec0970f5b99 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Wed, 26 Mar 2025 19:40:28 +0100 Subject: frontend: Migrate to eslint-plugin-svelte 3.0 This includes a migration to a flat eslint.config.js, which will now also automatically ignore items from .gitignore. eslint-plugin-svelte 3.0 comes with a couple of changes to recommended rules as well, these are also addressed in this commit. --- frontend/eslint.config.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 frontend/eslint.config.js (limited to 'frontend/eslint.config.js') diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js new file mode 100644 index 0000000..308fe8a --- /dev/null +++ b/frontend/eslint.config.js @@ -0,0 +1,37 @@ +import { includeIgnoreFile } from '@eslint/compat'; +import js from '@eslint/js'; +import prettier from 'eslint-config-prettier'; +import svelte from 'eslint-plugin-svelte'; +import globals from 'globals'; +import { fileURLToPath } from 'node:url'; +import ts from 'typescript-eslint'; +import svelteConfig from './svelte.config.js'; + +const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url)); + +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'], + ignores: ['eslint.config.js', 'svelte.config.js'], + languageOptions: { + parserOptions: { + projectService: true, + extraFileExtensions: ['.svelte'], + parser: ts.parser, + svelteConfig + } + } + } +); -- cgit v1.2.3-2-gb3c3