83 lines
2.1 KiB
JavaScript
83 lines
2.1 KiB
JavaScript
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, __APP_VERSION__: "readonly" },
|
||
},
|
||
},
|
||
|
||
// .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": ["warn", { argsIgnorePattern: "^_" }],
|
||
|
||
// Existing Svelte 5 migration warnings are tracked without blocking the gate.
|
||
"svelte/prefer-svelte-reactivity": "warn",
|
||
"svelte/prefer-writable-derived": "warn",
|
||
"svelte/no-unused-svelte-ignore": "warn",
|
||
"svelte/no-at-html-tags": "warn",
|
||
"svelte/no-useless-children-snippet": "warn",
|
||
|
||
// {#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/",
|
||
"playwright-report/",
|
||
"test-results/",
|
||
"e2e/",
|
||
"scripts/",
|
||
],
|
||
},
|
||
];
|