From 94260b1058120597d97e321d0c9a9e01a6b77c2c Mon Sep 17 00:00:00 2001 From: Proxyfil Date: Mon, 6 Apr 2026 23:57:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Updated=20eslint=20configuration?= =?UTF-8?q?=20to=20comply=20with=20new=20version=20requirements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/.eslintrc.cjs | 36 ---------------- frontend/eslint.config.cjs | 84 ++++++++++++++++++++++++++++++++++++++ frontend/package.json | 8 ++-- 3 files changed, 89 insertions(+), 39 deletions(-) delete mode 100644 frontend/.eslintrc.cjs create mode 100644 frontend/eslint.config.cjs diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs deleted file mode 100644 index 3aeb85a..0000000 --- a/frontend/.eslintrc.cjs +++ /dev/null @@ -1,36 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Marlon W (Mawoka) -// -// SPDX-License-Identifier: MPL-2.0 - -module.exports = { - root: true, - parser: '@typescript-eslint/parser', - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], - plugins: ['svelte3', '@typescript-eslint'], - ignorePatterns: ['*.cjs'], - overrides: [ - { files: ['*.svelte'], processor: 'svelte3/svelte3' }, - { - files: ['*.*'], - rules: { - 'a11y-click-events-have-key-events': 'off' - } - } - ], - rules: { - 'no-unused-vars': ['error', { argsIgnorePattern: '^_' }], - '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }] - }, - settings: { - 'svelte3/typescript': () => require('typescript') - }, - parserOptions: { - sourceType: 'module', - ecmaVersion: 2020 - }, - env: { - browser: true, - es2017: true, - node: true - } -}; diff --git a/frontend/eslint.config.cjs b/frontend/eslint.config.cjs new file mode 100644 index 0000000..c8f513e --- /dev/null +++ b/frontend/eslint.config.cjs @@ -0,0 +1,84 @@ +const { defineConfig, globalIgnores } = require('eslint/config'); + +const tsParser = require('@typescript-eslint/parser'); +const typescriptEslint = require('@typescript-eslint/eslint-plugin'); +const globals = require('globals'); +const js = require('@eslint/js'); +const svelte = require('eslint-plugin-svelte'); + +module.exports = defineConfig([ + js.configs.recommended, + svelte.configs.recommended, + globalIgnores(['**/*.cjs', 'src/app.html']), + { + languageOptions: { + sourceType: 'module', + ecmaVersion: 2020, + + globals: { + ...globals.browser, + ...globals.node + } + } + }, + { + files: ['**/*.{ts,js}'], + languageOptions: { + parser: tsParser + }, + + plugins: { + '@typescript-eslint': typescriptEslint + }, + + rules: { + 'no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_.*' + } + ], + + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_.*' + } + ] + } + }, + { + files: ['**/*.svelte'], + languageOptions: { + parserOptions: { + parser: tsParser, + extraFileExtensions: ['.svelte'] + } + } + }, + { + files: ['**/*.svelte', '**/*.ts', '**/*.js'], + + rules: { + 'a11y-click-events-have-key-events': 'off', + 'no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_.*' + } + ], + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_.*' + } + ], + 'svelte/no-at-html-tags': 'warn', + 'svelte/require-each-key': 'warn' + }, + + plugins: { + '@typescript-eslint': typescriptEslint + } + } +]); diff --git a/frontend/package.json b/frontend/package.json index e206ad5..fdb64e9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -8,9 +8,9 @@ "preview": "vite preview", "check": "svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . '!src/lib/i18n/locales/*.json' '!pnpm-lock.yaml' '!src/app.html' && eslint --ignore-path .gitignore .", - "lint-without-format-checking": "eslint --ignore-path .gitignore .", - "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. . '!src/lib/i18n/locales/*.json'", + "lint": "prettier --check --plugin-search-dir=. . '!src/lib/i18n/locales/*.json' '!pnpm-lock.yaml' '!src/app.html' && eslint .", + "lint-without-format-checking": "eslint .", + "format": "prettier --write --plugin-search-dir=. . '!src/lib/i18n/locales/*.json'", "run:prod": "node index.js", "translations-scan": "i18next-scanner --config i18next-scanner.config.engine.cjs src/**/*.svelte" }, @@ -58,6 +58,7 @@ "dompurify": "^3.3.0", "eslint": "^9.38.0", "eslint-config-prettier": "^10.1.8", + "eslint-plugin-svelte": "^3.17.0", "felte": "^1.3.0", "fuse.js": "^7.1.0", "highlight.js": "^11.11.1", @@ -82,6 +83,7 @@ "socket.io-client": "^4.8.1", "svelte": "^5.42.2", "svelte-check": "^4.3.3", + "svelte-eslint-parser": "^1.6.0", "svelte-preprocess": "^6.0.3", "svelte-range-slider-pips": "^4.1.0", "svelte-tippy": "^1.3.2",