-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
100 lines (94 loc) · 3.53 KB
/
eslint.config.js
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
import eslint from '@eslint/js'
import prettier from 'eslint-config-prettier'
import svelte from 'eslint-plugin-svelte'
import globals from 'globals'
import svelteParser from 'svelte-eslint-parser'
import tseslint from 'typescript-eslint'
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
export default tseslint.config(
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
extends: [
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
prettier,
],
files: ['.js', '.mjs', '.mts', '.svelte', '.ts'].flatMap(e => [`**/*${e}`, `*${e}`]),
languageOptions: {
globals: { ...globals.browser, ...globals.node },
parser: tseslint.parser,
parserOptions: { extraFileExtensions: ['.svelte'], project: './tsconfig.eslint.json' },
},
rules: {
'@typescript-eslint/class-methods-use-this': [
'error',
{ ignoreClassesThatImplementAnInterface: true, ignoreOverrideMethods: true },
],
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{ fixStyle: 'separate-type-imports' },
],
'@typescript-eslint/default-param-last': 'error',
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
'@typescript-eslint/method-signature-style': 'error',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-useless-empty-export': 'error',
'@typescript-eslint/prefer-nullish-coalescing': ['error', { ignorePrimitives: true }],
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/prefer-regexp-exec': 'error',
'@typescript-eslint/promise-function-async': ['error', { checkArrowFunctions: false }],
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{ allowBoolean: true, allowNullish: true, allowNumber: true, allowRegExp: true },
],
'@typescript-eslint/return-await': 'error',
'@typescript-eslint/sort-type-constituents': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'func-style': ['error', 'declaration'],
'@typescript-eslint/no-throw-literal': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
},
},
{
extends: [...svelte.configs['flat/recommended'], ...svelte.configs['flat/prettier']],
files: ['.svelte'].flatMap(e => [`**/*${e}`, `*${e}`]),
languageOptions: {
parser: svelteParser,
parserOptions: { project: './tsconfig.eslint.json', parser: tseslint.parser },
},
rules: {
'@typescript-eslint/no-empty-function': 'off', // This is how you do optional events in SvelteKit
'@typescript-eslint/no-unsafe-assignment': 'off', // This rule is broken when using `$props()`.
'prefer-const': 'off', // This rule is broken when using `$props()`.
'svelte/no-at-html-tags': 'off',
},
},
{
ignores: [
'.pnpm-store/',
'.svelte-kit/',
'android/app/build/',
'android/app/src/main/assets/public/',
'build/',
'capacitor-cordova-android-plugins/',
'coverage/',
'dist/',
'node_modules/',
'package/',
'playwright-report/',
'test-results/',
'*.cjs',
'*.tsbuildinfo',
'**/$types.d.ts',
'vite.config.js.timestamp-*',
'vite.config.ts.timestamp-*',
],
},
)