-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.ts
103 lines (93 loc) · 2.29 KB
/
index.ts
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
import type { Linter } from 'eslint'
import { perfectionist } from './perfectionist'
import { packageJson } from './package-json'
import { typescript } from './typescript'
import { svelte } from './svelte'
import { vitest } from './vitest'
import { react } from './react'
import { astro } from './astro'
import { qwik } from './qwik'
import { a11y } from './a11y'
import { core } from './core'
import { node } from './node'
import { vue } from './vue'
const CONFIG_OPTIONS = [
'perfectionist',
'typescript',
'svelte',
'vitest',
'astro',
'react',
'qwik',
'node',
'vue',
] as const
export type ConfigOptions = Required<ConfigOptionFlags>
type RawConfigOptions = {
extends?: Linter.Config[] | Linter.Config
} & Partial<ConfigOptionFlags>
type ConfigOptionFlags = Record<ConfigOptionKeys, boolean>
type ConfigOptionKeys = (typeof CONFIG_OPTIONS)[number]
export default async ({
extends: customExtends = {} as Linter.Config,
...rawConfig
}: RawConfigOptions = {}): Promise<Linter.Config[]> => {
let config: Required<ConfigOptionFlags> = {} as Required<ConfigOptionFlags>
for (let configName of CONFIG_OPTIONS) {
config[configName] = rawConfig[configName] ?? false
}
let configFunctions = [
core,
a11y,
react,
node,
typescript,
vitest,
astro,
svelte,
qwik,
vue,
packageJson,
perfectionist,
]
let configs = await Promise.all(
configFunctions.map(createConfigFunction => createConfigFunction(config)),
)
return [
{
ignores: [
'**/.eslint-config-inspector/**',
'**/vite.config.*.timestamp-*',
'**/.vitepress/cache/**',
'**/node_modules/**',
'**/.svelte-kit/**',
'**/coverage/**',
'**/.history/**',
'**/.netlify/**',
'**/.vercel/**',
'**/.output/**',
'**/.astro/**',
'**/output/**',
'**/.cache/**',
'**/.temp/**',
'**/build/**',
'**/.nuxt/**',
'**/.next/**',
'**/dist/**',
'**/temp/**',
'**/.tmp/**',
'**/tmp/**',
],
name: 'azat-io/core/ignores',
},
...configs,
...(Array.isArray(customExtends)
? customExtends
: [
{
name: 'azat-io/custom-extends',
...customExtends,
},
]),
]
}