@@ -23,19 +23,8 @@ import {
23
23
unocss ,
24
24
vue ,
25
25
} from './configs'
26
- import {
27
- combine ,
28
- getOverrides ,
29
- interopDefault ,
30
- loadPrettierConfig ,
31
- resolveSubOptions ,
32
- } from './shared'
33
- import type {
34
- Awaitable ,
35
- FlatConfigItem ,
36
- OptionsConfig ,
37
- UserConfigItem ,
38
- } from './types'
26
+ import { combine , getOverrides , interopDefault , loadPrettierConfig , resolveSubOptions } from './shared'
27
+ import type { Awaitable , FlatConfigItem , OptionsConfig , UserConfigItem } from './types'
39
28
40
29
const flatConfigProps : ( keyof FlatConfigItem ) [ ] = [
41
30
'files' ,
@@ -60,12 +49,7 @@ export async function defineConfig(
60
49
const {
61
50
componentExts = [ ] ,
62
51
gitignore : enableGitignore = true ,
63
- isInEditor = ! ! (
64
- ( process . env . VSCODE_PID ||
65
- process . env . JETBRAINS_IDE ||
66
- process . env . VIM ) &&
67
- ! process . env . CI
68
- ) ,
52
+ isInEditor = ! ! ( ( process . env . VSCODE_PID || process . env . JETBRAINS_IDE || process . env . VIM ) && ! process . env . CI ) ,
69
53
react : enableReact = false ,
70
54
svelte : enableSvelte = false ,
71
55
typescript : enableTypeScript = isPackageExists ( 'typescript' ) ,
@@ -78,18 +62,10 @@ export async function defineConfig(
78
62
79
63
if ( enableGitignore ) {
80
64
if ( typeof enableGitignore !== 'boolean' ) {
81
- configs . push (
82
- interopDefault ( import ( 'eslint-config-flat-gitignore' ) ) . then ( r => [
83
- r ( enableGitignore ) ,
84
- ] ) ,
85
- )
65
+ configs . push ( interopDefault ( import ( 'eslint-config-flat-gitignore' ) ) . then ( r => [ r ( enableGitignore ) ] ) )
86
66
} else {
87
67
if ( fs . existsSync ( '.gitignore' ) )
88
- configs . push (
89
- interopDefault ( import ( 'eslint-config-flat-gitignore' ) ) . then ( r => [
90
- r ( ) ,
91
- ] ) ,
92
- )
68
+ configs . push ( interopDefault ( import ( 'eslint-config-flat-gitignore' ) ) . then ( r => [ r ( ) ] ) )
93
69
}
94
70
}
95
71
@@ -187,16 +163,11 @@ export async function defineConfig(
187
163
}
188
164
189
165
if ( usePrettierrc ) {
190
- const prettierConfig = await loadPrettierConfig (
191
- options . cwd ?? process . cwd ( ) ,
192
- )
166
+ const prettierConfig = await loadPrettierConfig ( options . cwd ?? process . cwd ( ) )
193
167
Object . assign ( prettierRules , prettierConfig )
194
168
}
195
169
196
- configs . push (
197
- prettier ( prettierRules ) ,
198
- formatter ( options . formatter , prettierRules ) ,
199
- )
170
+ configs . push ( prettier ( prettierRules ) , formatter ( options . formatter , prettierRules ) )
200
171
201
172
// User can optionally pass a flat config item to the first argument
202
173
// We pick the known keys as ESLint would do schema validation
0 commit comments