-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
114 lines (107 loc) · 2.41 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import globals from 'globals'
import js from '@eslint/js'
import ts from 'typescript-eslint'
import astro from 'eslint-plugin-astro'
import astroParser from 'astro-eslint-parser'
const ignoresGlobal = [
'.astro/**',
'src/generated.ts',
]
const astroFiles = [
'src/**/*.astro',
]
const jsFiles = [
'eslint.config.js',
]
const tsFiles = [
...astroFiles.map((path) => `${path}/*.ts`),
'*.ts',
'src/**/*.ts',
'scripts/**/*.ts',
]
export default ts.config(
{
ignores: ignoresGlobal,
},
{
files: astroFiles,
extends: [
...astro.configs.recommended,
],
processor: astro.processors['client-side-ts'],
languageOptions: {
parser: astroParser,
parserOptions: {
parser: ts.parser,
sourceType: 'module',
extraFileExtensions: ['.astro'],
},
globals: {
...globals.node,
...astro.environments.astro.globals,
},
},
rules: {
'astro/semi': ['warn', 'never'],
},
},
{
files: tsFiles,
extends: [
js.configs.recommended,
...ts.configs.recommendedTypeChecked,
],
languageOptions: {
parser: ts.parser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
files: tsFiles,
rules: {
'no-empty': 'off',
'@typescript-eslint/no-empty': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-empty-function': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'prefer-const': 'warn',
},
},
{
files: jsFiles,
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
...js.configs.recommended,
rules: {
'no-empty': 'off',
'no-empty-function': 'warn',
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'prefer-const': 'warn',
},
},
{
files: [...tsFiles, ...jsFiles],
languageOptions: {
globals: {
...globals.node,
...globals.browser,
},
},
rules: {
indent: ['warn', 2, { SwitchCase: 1 }],
semi: ['warn', 'never'],
quotes: ['warn', 'single'],
'comma-dangle': ['warn', 'always-multiline'],
'arrow-parens': ['warn', 'always'],
'eol-last': ['warn', 'always'],
},
},
)