-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
101 lines (91 loc) · 2.26 KB
/
eslint.config.js
File metadata and controls
101 lines (91 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// ESLint flat config for SvelteKit + TypeScript + Prettier
// Migrated from .eslintrc.cjs to eslint.config.js (Flat Config)
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier/flat";
import svelte from "eslint-plugin-svelte";
import globals from "globals";
import enforceGuardedExports from "./eslint/enforce-guarded-functions.js";
import svelteConfig from "./svelte.config.js";
// Use the typescript-eslint aggregator for flat config presets
// (requires devDependency: "typescript-eslint")
import tseslint from "typescript-eslint";
export default [
// Ignore generated and build artifacts
{
ignores: [
// migrated from .eslintignore
".DS_Store",
"node_modules",
"build",
".svelte-kit",
"package",
".env",
".env.*",
"pnpm-lock.yaml",
"package-lock.json",
"yarn.lock",
// additional
"dist",
".vite",
"drizzle",
"supabase/**/migrations/**"
]
},
// Base language options and globals
{
languageOptions: {
ecmaVersion: 2020,
sourceType: "module",
globals: {
...globals.browser,
...globals.node,
// Svelte built-in types
$$Generic: "readonly",
App: "readonly"
}
}
},
// Core JS recommended rules
js.configs.recommended,
// TypeScript rules (no type-aware rules by default)
...tseslint.configs.recommended,
// Svelte plugin recommended rules for Svelte files
...svelte.configs["flat/recommended"],
{
files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
languageOptions: {
parserOptions: {
// Ensure TS within <script lang="ts"> is parsed
parser: tseslint.parser,
projectService: true,
extraFileExtensions: [".svelte"],
// Pass through SvelteKit config for better rule behavior
svelteConfig
}
}
},
// Turn off formatting-related Svelte rules to avoid conflicts with Prettier
...svelte.configs["flat/prettier"],
// Project-wide rule tweaks
{
rules: {
"require-yield": "off",
"svelte/no-navigation-without-resolve": "off"
}
},
// Keep Prettier last to disable conflicting stylistic rules
eslintConfigPrettier,
{
files: ["**/*.remote.ts"],
plugins: {
custom: {
rules: {
"enforce-guarded-functions": enforceGuardedExports
}
}
},
rules: {
"custom/enforce-guarded-functions": "error"
}
}
];