diff --git a/.prettierignore b/.prettierignore index bc997b107..50f1dcbab 100644 --- a/.prettierignore +++ b/.prettierignore @@ -32,4 +32,5 @@ tailwind.config.cjs tsconfig.json .pnpm-store src/i18n -.devcontainer/devcontainer.json \ No newline at end of file +.devcontainer/devcontainer.json +.vscode/ \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index 3d676e7e9..fda9de173 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/eslint.config.js b/eslint.config.js index 9d4ee96e5..bb85a68b3 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,7 +1,8 @@ -import typescriptParser from '@typescript-eslint/parser'; -import typescriptPlugin from '@typescript-eslint/eslint-plugin'; -import sveltePlugin from "eslint-plugin-svelte"; -import svelteParser from "svelte-eslint-parser"; +import js from '@eslint/js'; +import ts from 'typescript-eslint'; +import svelte from 'eslint-plugin-svelte'; +import globals from 'globals'; + const rules = { 'array-callback-return': 'error', @@ -26,65 +27,49 @@ const rules = { 'no-shadow': 'error', 'no-use-before-define': 'error', 'no-unused-vars': 'off', - '@typescript-eslint/no-unused-vars': ['error', { - varsIgnorePattern: '^_', - argsIgnorePattern: '^_' - }] + '@typescript-eslint/no-unused-vars': [ + 'warn', { + varsIgnorePattern: '^_', + argsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + } + ], + // TODO: This was disabled to due the explicit side-effect style in svelte (`$: ...`). Can be re-enabled with runes + '@typescript-eslint/no-unused-expressions': 'off', + 'svelte/no-at-html-tags': 'warn', }; export default [ + js.configs.recommended, + ...ts.configs.recommended, + ...svelte.configs['flat/recommended'], + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + }, + }, + }, { ignores: [ ".svelte-kit/**/*", "node_modules/**/*", "dist/**/*", "build/**/*", - "src/i18n/**/*" + "src/i18n/**/*", + "postcss.config.cjs", ], }, - - { - files: ["**/*.ts"], - ignores: [ - "custom-theme.ts", - "src/service-worker.ts", - "tailwind.config.ts" - ], - languageOptions: { - parser: typescriptParser, - parserOptions: { - project: "./tsconfig.json", - extraFileExtensions: [".svelte"], - }, - }, - plugins: { - "@typescript-eslint": typescriptPlugin, - }, - rules: { - ...typescriptPlugin.configs.recommended.rules, - ...rules - }, - }, - { files: ["**/*.svelte"], languageOptions: { - parser: svelteParser, parserOptions: { - parser: typescriptParser, - project: "./tsconfig.json", - extraFileExtensions: [".svelte"], + parser: ts.parser, }, }, - plugins: { - svelte: sveltePlugin, - "@typescript-eslint": typescriptPlugin, - }, - rules: { - ...typescriptPlugin.configs.recommended.rules, - ...sveltePlugin.configs.recommended.rules, - ...rules, - 'svelte/no-at-html-tags': 'off' - }, }, -]; + { + rules + } +]; \ No newline at end of file diff --git a/package.json b/package.json index 6200503d8..f241d9d69 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,11 @@ "format": "prettier --write . && eslint . --fix", "translations": "bash ./download_translations.sh" }, + "config": { + "commitizen": { + "path": "@commitlint/cz-commitlint" + } + }, "dependencies": { "@felte/core": "^1.4.3", "@felte/reporter-svelte": "^1.1.11", @@ -46,15 +51,16 @@ "prismjs": "^1.29.0", "semver": "^7.6.3", "socket.io-client": "^4.7.5", - "tslib": "^2.6.3", "thumbhash": "^0.1.1", + "tslib": "^2.6.3", "wonka": "^6.3.4", "zod": "^3.23.8" }, "devDependencies": { "@cfworker/json-schema": "^1.12.8", "@commitlint/cli": "^19.3.0", - "@commitlint/config-conventional": "^19.2.2", + "@commitlint/config-conventional": "^19.3.0", + "@commitlint/cz-commitlint": "^19.5.0", "@eslint/eslintrc": "^3.1.0", "@graphql-codegen/add": "^5.0.3", "@graphql-codegen/cli": "^5.0.2", @@ -80,21 +86,20 @@ "@types/node": "^20.14.12", "@types/prismjs": "^1.26.4", "@types/semver": "^7.5.8", - "@typescript-eslint/eslint-plugin": "^7.17.0", - "@typescript-eslint/parser": "^7.17.0", "autoprefixer": "^10.4.19", "chokidar-cli": "^3.0.0", "concurrently": "^8.2.2", "cookieconsent": "^3.1.1", "cross-env": "^7.0.3", "cssnano": "^7.0.4", - "cz-conventional-changelog": "^3.3.0", + "cz": "^1.8.2", "dotenv-flow": "^4.1.0", - "eslint": "^9.7.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-svelte": "^2.43.0", + "eslint": "^9.7", + "eslint-config-prettier": "^9.1", + "eslint-plugin-svelte": "^2.43", "graphql-tag": "^2.12.6", "husky": "^9.1.1", + "inquirer": "9", "postcss": "^8.4.40", "postcss-import-url": "^7.2.0", "postcss-load-config": "^6.0.1", @@ -110,6 +115,7 @@ "svelte-preprocess": "^6.0.2", "tailwindcss": "^3.4.6", "typescript": "^5.5.4", + "typescript-eslint": "^8.13.0", "urql": "^4.1.0", "vite": "^5.3.5", "vite-plugin-tailwind-purgecss": "^0.3.3" diff --git a/src/lib/components/mods/compatibility/CompatibilityGrid.svelte b/src/lib/components/mods/compatibility/CompatibilityGrid.svelte index 62671e080..407d6069d 100644 --- a/src/lib/components/mods/compatibility/CompatibilityGrid.svelte +++ b/src/lib/components/mods/compatibility/CompatibilityGrid.svelte @@ -61,7 +61,7 @@ {#if compatibility?.EA?.note} {#await markdown(compatibility.EA.note) then rendered} - {@html rendered} + {@html rendered} {/await} {:else} {noNotesText} @@ -72,7 +72,7 @@ {#if compatibility?.EXP?.note} {#await markdown(compatibility.EXP.note) then rendered} - {@html rendered} + {@html rendered} {/await} {:else} {noNotesText} diff --git a/src/lib/utils/mod.ts b/src/lib/utils/mod.ts index 2772700e0..9683e297f 100644 --- a/src/lib/utils/mod.ts +++ b/src/lib/utils/mod.ts @@ -22,7 +22,7 @@ export const modStatus = (latestVersions?: { } result = 'own-risk'; } - } catch (e) { + } catch (_e) { // Ignored } } diff --git a/src/lib/utils/uplugin.ts b/src/lib/utils/uplugin.ts index c323530b2..3d18ef5ca 100644 --- a/src/lib/utils/uplugin.ts +++ b/src/lib/utils/uplugin.ts @@ -19,7 +19,7 @@ const resolveValue = (object: unknown, path: string) => { key = parser.exec(path); } return value; - } catch (e) { + } catch (_e) { // Ignore exception } @@ -56,7 +56,7 @@ export const validateUPluginJson = async (input: string): Promise => { return message; }) .filter((v) => !!v); - } catch (e) { + } catch (_e) { return ['Invalid JSON']; } };