-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
92 lines (90 loc) · 2.64 KB
/
eslint.config.js
File metadata and controls
92 lines (90 loc) · 2.64 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
// eslint.config.cjs
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import eslintPluginSvelte from 'eslint-plugin-svelte'
import js from '@eslint/js'
import svelteParser from 'svelte-eslint-parser'
import tsEslint, { parser } from 'typescript-eslint'
import tsParser from '@typescript-eslint/parser'
import globals from 'globals'
export default [
js.configs.recommended,
...tsEslint.configs.recommended,
...eslintPluginSvelte.configs['flat/recommended'],
eslintPluginPrettierRecommended, // must be last to override conflicting rules.
{
languageOptions: {
parser: tsParser,
parserOptions: {
sourceType: 'module',
project: ['./tsconfig.eslint.json'],
extraFileExtensions: ['.svelte']
},
globals: { ...globals.browser, ...globals.node }
},
rules: {
/* rules for js/ts/svelte */
'no-console': ['error', { allow: ['info', 'warn', 'error'] }],
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
// this is a workaround until the parser supports reserved interface names
// subject to change: https://github.com/sveltejs/eslint-plugin-svelte/issues/348
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_|^\\$\\$(Props|Events|Slots)$',
caughtErrorsIgnorePattern: '^_'
}
],
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'sort-imports': [
'error',
{
ignoreDeclarationSort: true
}
],
'padding-line-between-statements': [
'error',
{ prev: 'import', next: '*', blankLine: 'always' },
{ prev: 'import', next: 'import', blankLine: 'never' },
{ prev: 'export', next: '*', blankLine: 'always' },
{ prev: 'export', next: 'export', blankLine: 'any' },
{ prev: 'let', next: 'export', blankLine: 'any' },
{ prev: 'multiline-block-like', next: '*', blankLine: 'always' },
{ prev: 'multiline-expression', next: '*', blankLine: 'always' },
{ prev: '*', next: 'return', blankLine: 'always' }
],
// FIXME: Temporary fix to be able to use $t
// https://github.com/sveltejs/svelte-eslint-parser/issues/423
// https://github.com/sveltejs/eslint-plugin-svelte/issues/652
'svelte/valid-compile': 'off'
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: tsParser
}
},
rules: {}
},
{
ignores: [
'.DS_Store',
'node_modules/',
'build/',
'.svelte-kit/',
'package/',
'.env',
'.env.*',
'!.env.example',
'.gitignore',
'pnpm-lock.yaml',
'eslint.config.js',
'**/*.cjs'
]
}
]