chore: align eslint config with ainative approach

- Add typescript-eslint parser for .svelte.ts and <script lang='ts'>
- Disable no-console (CoT logging is intentional)
- Downgrade require-each-key and no-navigation-without-resolve to warn
- Add Svelte 5 runes (, , etc.) as globals for .svelte.ts
This commit is contained in:
2026-06-03 14:43:46 +03:00
parent 615b5fee9f
commit ec57294920
2 changed files with 54 additions and 5 deletions

View File

@@ -1,23 +1,71 @@
import svelte from "eslint-plugin-svelte";
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
export default [
js.configs.recommended,
...svelte.configs["flat/recommended"],
// Global language options (applies to all files)
{
languageOptions: {
globals: { ...globals.browser, ...globals.node },
},
rules: {
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"no-console": ["warn", { allow: ["info", "warn", "error"] }],
},
// .svelte.ts files (Svelte 5 rune stores/models) — parse as TypeScript
{
files: ["**/*.svelte.ts"],
languageOptions: {
parser: tseslint.parser,
globals: {
$state: "readonly",
$derived: "readonly",
$effect: "readonly",
$props: "readonly",
$bindable: "readonly",
$inspect: "readonly",
},
},
},
// .svelte files with <script lang="ts"> — use TS parser inside Svelte
{
files: ["**/*.svelte"],
languageOptions: {
parserOptions: {
parser: tseslint.parser,
},
},
},
// Global rules — ainative-осознанные настройки
{
rules: {
// CoT-логирование — intentional, не блокировать
"no-console": "off",
// Неиспользуемые переменные — error с игнором _префикса
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
// {#each key} — warn вместо error для быстрых итераций
"svelte/require-each-key": "warn",
// goto/href без resolve() — warn вместо error
"svelte/no-navigation-without-resolve": "warn",
},
},
// Игноры
{
ignores: [
"node_modules/", "dist/", "build/",
".svelte-kit/", ".vite/", "coverage/",
"node_modules/",
"dist/",
"build/",
".svelte-kit/",
".vite/",
"coverage/",
],
},
];

View File

@@ -31,6 +31,7 @@
"postcss": "^8.4.0",
"svelte": "^5.43.8",
"tailwindcss": "^3.0.0",
"typescript-eslint": "^8.60.1",
"vite": "^7.2.4",
"vitest": "^4.0.18"
},