chore: add eslint config

This commit is contained in:
HorizonCode 2025-07-04 22:15:53 +02:00
parent d058b24ba2
commit 1d3448cbf5
2 changed files with 48 additions and 1 deletions

40
eslint.config.js Normal file
View File

@ -0,0 +1,40 @@
import prettier from 'eslint-config-prettier';
import { includeIgnoreFile } from '@eslint/compat';
import js from '@eslint/js';
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: {
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
'no-undef': 'off',
},
},
{
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
languageOptions: {
parserOptions: {
projectService: true,
extraFileExtensions: ['.svelte'],
parser: ts.parser,
svelteConfig,
},
},
}
);

View File

@ -14,7 +14,7 @@
"tauri": "tauri", "tauri": "tauri",
"update-logo": "bun run tauri icon ./static/logo.png", "update-logo": "bun run tauri icon ./static/logo.png",
"format": "prettier --write .", "format": "prettier --write .",
"lint": "prettier --check ." "lint": "prettier --check . && eslint ."
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -40,6 +40,8 @@
"svelte-confetti": "^2.0.0" "svelte-confetti": "^2.0.0"
}, },
"devDependencies": { "devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/js": "^9.18.0",
"@lucide/svelte": "^0.482.0", "@lucide/svelte": "^0.482.0",
"@sveltejs/adapter-static": "3.0.8", "@sveltejs/adapter-static": "3.0.8",
"@sveltejs/kit": "2.22.2", "@sveltejs/kit": "2.22.2",
@ -49,6 +51,10 @@
"autoprefixer": "10.4.21", "autoprefixer": "10.4.21",
"bits-ui": "^1.4.7", "bits-ui": "^1.4.7",
"clsx": "2.1.1", "clsx": "2.1.1",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-svelte": "^3.0.0",
"globals": "^16.0.0",
"mode-watcher": "^1.0.6", "mode-watcher": "^1.0.6",
"prettier": "^3.4.2", "prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.3.3", "prettier-plugin-svelte": "^3.3.3",
@ -62,6 +68,7 @@
"tailwindcss-animate": "1.0.7", "tailwindcss-animate": "1.0.7",
"tslib": "2.8.1", "tslib": "2.8.1",
"typescript": "5.8.3", "typescript": "5.8.3",
"typescript-eslint": "^8.20.0",
"vite": "7.0.0", "vite": "7.0.0",
"vite-plugin-devtools-json": "^0.2.0" "vite-plugin-devtools-json": "^0.2.0"
} }