-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
110 lines (96 loc) · 2.34 KB
/
eslint.config.mjs
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
102
103
104
105
106
107
108
109
110
import eslint from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginAstro from 'eslint-plugin-astro';
import eslintPluginSvelte from 'eslint-plugin-svelte';
import tseslint from 'typescript-eslint';
import parserAstro from 'astro-eslint-parser';
import parserSvelte from 'svelte-eslint-parser';
import globals from 'globals';
import svelteConfig from './svelte.config.js';
export default tseslint.config(
{
ignores: [
'**/.DS_Store',
'**/node_modules',
'build',
'dist',
'.svelte-kit',
'package',
'**/.env',
'**/.env.*',
'!**/.env.example',
'**/pnpm-lock.yaml',
'**/package-lock.json',
'**/yarn.lock',
'src/env.d.ts', // auto generated by astro
],
},
eslint.configs.recommended,
eslintConfigPrettier,
...eslintPluginSvelte.configs['flat/recommended'],
...tseslint.configs.recommended,
...eslintPluginAstro.configs.recommended,
{
plugins: {
'@typescript-eslint': tseslint.plugin,
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parser: tseslint.parser,
ecmaVersion: 2020,
sourceType: 'module',
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
},
],
},
},
{
files: ['tests/**/*.ts'],
languageOptions: {
parser: tseslint.parser,
ecmaVersion: 5,
sourceType: 'script',
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'require-await': 'off',
'@typescript-eslint/require-await': 'error',
'svelte/no-inner-declarations': 'off', // FIXME: for some reason this rule is broken and causes eslint to crash
},
},
{
files: ['**/*.astro'],
languageOptions: {
parser: parserAstro,
ecmaVersion: 5,
sourceType: 'script',
parserOptions: {
parser: tseslint.parser,
extraFileExtensions: ['.astro'],
},
},
},
{
files: ['*.svelte', '**/*.svelte'],
languageOptions: {
parser: parserSvelte,
parserOptions: {
parser: tseslint.parser,
svelteConfig,
extraFileExtensions: ['.svelte'],
},
},
},
);