-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy patheslint.config.ts
More file actions
86 lines (80 loc) · 2.84 KB
/
eslint.config.ts
File metadata and controls
86 lines (80 loc) · 2.84 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
import js from "@eslint/js"
import globals from "globals"
import tsESLint from "typescript-eslint"
import stylistic from "@stylistic/eslint-plugin"
import svelte from "eslint-plugin-svelte"
import svelteParser from "svelte-eslint-parser"
import { defineConfig } from "eslint/config"
export default defineConfig([
// ------------------------------------------------------------------------
// 1. Ignore build folders
// ------------------------------------------------------------------------
{
ignores: [
"node_modules/**",
"build/**",
".svelte-kit/**",
],
},
// ------------------------------------------------------------------------
// 2. Base recommended configs FIRST
// ------------------------------------------------------------------------
js.configs.recommended,
...tsESLint.configs.recommended,
...svelte.configs.recommended,
// ------------------------------------------------------------------------
// 3. TypeScript files
// ------------------------------------------------------------------------
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
languageOptions: {
parser: tsESLint.parser,
globals: globals.browser,
},
plugins: {
"@stylistic": stylistic,
},
},
// ------------------------------------------------------------------------
// 4. Svelte files
// ------------------------------------------------------------------------
{
files: ["**/*.svelte"],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: tsESLint.parser,
extraFileExtensions: [".svelte"],
},
globals: globals.browser,
},
},
// ------------------------------------------------------------------------
// 5. Shared stylistic + rules
// ------------------------------------------------------------------------
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts,svelte}"],
plugins: {
"@stylistic": stylistic,
},
rules: {
...stylistic.configs.customize({
indent: 4,
quotes: "double",
semi: false,
jsx: false,
}).rules,
"@stylistic/object-curly-spacing": ["error", "always"],
"@stylistic/brace-style": ["error", "1tbs", { allowSingleLine: true }],
"@typescript-eslint/no-unused-vars": ["warn", {
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
}],
},
},
])