-
-
Notifications
You must be signed in to change notification settings - Fork 227
Expand file tree
/
Copy patheslint.config.js
More file actions
64 lines (63 loc) · 1.9 KB
/
eslint.config.js
File metadata and controls
64 lines (63 loc) · 1.9 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
// eslint.config.js
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
import svelte from 'eslint-plugin-svelte'
import prettier from 'eslint-config-prettier'
import globals from 'globals'
export default [
js.configs.recommended,
...tseslint.configs.recommended, // TS rules for .ts
...svelte.configs['flat/recommended'], // Svelte + a11y rules
{
files: ['**/*.svelte'],
languageOptions: {
parserOptions: {
// Make <script lang="ts"> use TypeScript
parser: tseslint.parser
},
globals: {
...globals.browser, // window, fetch, etc.
...globals.node, // process, __dirname (if needed)
...globals.es2023
}
},
rules: {
// Typical useful TS rules in Svelte files
'@typescript-eslint/consistent-type-imports': 'error',
// Disable navigation without resolve for internal links
'svelte/no-navigation-without-resolve': 'off'
}
},
{
files: ['**/*.svelte.ts'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
extraFileExtensions: ['.svelte']
},
globals: {
...globals.browser,
...globals.es2023,
// Svelte 5 runes globals
$state: 'readonly',
$derived: 'readonly',
$effect: 'readonly',
$props: 'readonly',
$bindable: 'readonly',
$inspect: 'readonly'
}
}
},
{
rules: {
// Prefer TS version of unused-vars, and ignore _-prefixed
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
// Temporarily disable no-explicit-any for API response types
'@typescript-eslint/no-explicit-any': 'off'
}
},
prettier // turn off formatting-related ESLint rules (let Prettier own formatting)
]