From ded83248da7e175b0da7ddade652c2b5dc2684bc Mon Sep 17 00:00:00 2001
From: olli <144932831+OLILHR@users.noreply.github.com>
Date: Wed, 23 Oct 2024 20:58:30 +0200
Subject: [PATCH 1/2] Remove deprecated `.eslintrc` and configure
`eslint.config.js` (#52)
---
.eslintrc.cjs | 41 -----------
eslint.config.js | 70 ++++++++++++++++---
package-lock.json | 4 +-
package.json | 4 +-
src/lib/components/footer.svelte | 1 +
src/lib/components/icon-logo.svelte | 1 +
src/lib/features/ebd-form-header.svelte | 4 +-
src/lib/features/export-button.svelte | 3 +-
src/routes/+layout.svelte | 1 +
src/routes/+page.svelte | 1 +
src/routes/ebd/+page.svelte | 3 +-
.../ebd/[formatVersion]/[ebd]/+layout.svelte | 3 +-
.../ebd/[formatVersion]/[ebd]/+page.svelte | 5 +-
13 files changed, 81 insertions(+), 60 deletions(-)
delete mode 100644 .eslintrc.cjs
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
deleted file mode 100644
index 6829602..0000000
--- a/.eslintrc.cjs
+++ /dev/null
@@ -1,41 +0,0 @@
-module.exports = {
- root: true,
- extends: [
- "eslint:recommended",
- "plugin:@typescript-eslint/recommended",
- "plugin:svelte/recommended",
- "prettier"
- ],
- parser: "@typescript-eslint/parser",
- plugins: ["@typescript-eslint", "simple-import-sort"],
- parserOptions: {
- sourceType: "module",
- ecmaVersion: 2020,
- extraFileExtensions: [".svelte"],
- },
- overrides: [
- {
- files: ["*.svelte"],
- parser: "svelte-eslint-parser",
- parserOptions: {
- parser: {
- ts: "@typescript-eslint/parser",
- js: "espree",
- typescript: "@typescript-eslint/parser",
- },
- },
- },
- ],
- env: {
- browser: true,
- es2017: true,
- node: true,
- },
- rules: {
- "simple-import-sort/imports": "error",
- "simple-import-sort/exports": "error",
- "import/first": "error",
- "import/newline-after-import": "error",
- "import/no-duplicates": "error"
- },
-}
\ No newline at end of file
diff --git a/eslint.config.js b/eslint.config.js
index 1b3dac9..4912bc8 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -1,13 +1,65 @@
+import js from "@eslint/js";
+import tsPlugin from "@typescript-eslint/eslint-plugin";
+import tsParser from "@typescript-eslint/parser";
+import sveltePlugin from "eslint-plugin-svelte";
+import svelteParser from "svelte-eslint-parser";
+import prettierConfig from "eslint-config-prettier";
+import simpleImportSort from "eslint-plugin-simple-import-sort";
+import importPlugin from "eslint-plugin-import";
+
export default [
+ js.configs.recommended,
{
- ignores: [
- "package.json",
- "package-lock.json",
- ".svelte-kit/",
- "node_modules/",
- "test-results/",
- "static/ebd/",
- "build/*",
- ],
+ files: ["**/*.{js,ts,svelte}"],
+ plugins: {
+ "@typescript-eslint": tsPlugin,
+ svelte: sveltePlugin,
+ "simple-import-sort": simpleImportSort,
+ import: importPlugin,
+ },
+ languageOptions: {
+ parser: tsParser,
+ parserOptions: {
+ ecmaVersion: 2020,
+ sourceType: "module",
+ extraFileExtensions: [".svelte"],
+ },
+ globals: {
+ // Browser globals
+ window: "readonly",
+ document: "readonly",
+ console: "readonly",
+ fetch: "readonly",
+ setTimeout: "readonly",
+ clearTimeout: "readonly",
+ Blob: "readonly",
+ URL: "readonly",
+ HTMLDivElement: "readonly",
+ CustomEvent: "readonly",
+ // Node.js globals
+ process: "readonly",
+ },
+ },
+ rules: {
+ ...tsPlugin.configs.recommended.rules,
+ ...sveltePlugin.configs.recommended.rules,
+ "simple-import-sort/imports": "error",
+ "simple-import-sort/exports": "error",
+ "import/first": "error",
+ "import/newline-after-import": "error",
+ "import/no-duplicates": "error",
+ "svelte/no-at-html-tags": "warn", // Changed from 'error' to 'warn'
+ "no-undef": "error",
+ },
},
+ {
+ files: ["**/*.svelte"],
+ languageOptions: {
+ parser: svelteParser,
+ parserOptions: {
+ parser: tsParser,
+ },
+ },
+ },
+ prettierConfig,
];
diff --git a/package-lock.json b/package-lock.json
index 2db84e9..e1dce09 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,11 +1,11 @@
{
- "name": "sveltekit-static-template",
+ "name": "ebd.hochfrequenz.de",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "sveltekit-static-template",
+ "name": "ebd.hochfrequenz.de",
"version": "0.0.1",
"hasInstallScript": true,
"devDependencies": {
diff --git a/package.json b/package.json
index a07c2e4..8e86ad2 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "sveltekit-static-template",
+ "name": "ebd.hochfrequenz.de",
"version": "0.0.1",
"private": true,
"scripts": {
@@ -11,7 +11,7 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"format": "prettier '**/*.{svelte,js,jsx,ts,tsx,html,css,scss,json,yml,md}' --write",
"format:check": "prettier '**/*.{svelte,js,jsx,ts,tsx,html,css,scss,json,yml,md}' --check",
- "lint": "eslint .",
+ "lint": "eslint 'src/**/*.{js,ts,svelte}'",
"postinstall": "npx playwright install",
"test": "npx playwright test"
},
diff --git a/src/lib/components/footer.svelte b/src/lib/components/footer.svelte
index 096fba6..6a67216 100644
--- a/src/lib/components/footer.svelte
+++ b/src/lib/components/footer.svelte
@@ -1,6 +1,7 @@
diff --git a/src/lib/features/ebd-form-header.svelte b/src/lib/features/ebd-form-header.svelte
index acaa9d6..e61994d 100644
--- a/src/lib/features/ebd-form-header.svelte
+++ b/src/lib/features/ebd-form-header.svelte
@@ -1,7 +1,7 @@
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 0c9acc3..c221298 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -1,5 +1,6 @@
diff --git a/src/routes/ebd/+page.svelte b/src/routes/ebd/+page.svelte
index b7fdec6..a8f5604 100644
--- a/src/routes/ebd/+page.svelte
+++ b/src/routes/ebd/+page.svelte
@@ -1,7 +1,8 @@