1
1
/* eslint-disable perfectionist/sort-objects */
2
- import type { ExtraLibrariesOption , FrameworkOption , LintScriptOption , PromptResult } from './types'
2
+ import type { ExtraLibrariesOption , FrameworkOption , LintOption , PromptResult } from './types'
3
3
4
4
import fs from 'node:fs'
5
5
import path from 'node:path'
@@ -37,7 +37,7 @@ export async function run(options: CliRunOptions = {}): Promise<void> {
37
37
const argSkipPrompt = ! ! process . env . SKIP_PROMPT || options . yes
38
38
const argTemplate = < FrameworkOption [ ] > options . frameworks ?. map ( m => m ?. trim ( ) ) . filter ( Boolean )
39
39
const argExtra = < ExtraLibrariesOption [ ] > options . extra ?. map ( m => m ?. trim ( ) ) . filter ( Boolean )
40
- const argLintScript = < LintScriptOption > options . lint ?. trim ( )
40
+ const argLint = < LintOption > options . lint ?. trim ( )
41
41
42
42
if ( fs . existsSync ( path . join ( process . cwd ( ) , 'eslint.config.js' ) ) ) {
43
43
p . log . warn ( c . yellow `eslint.config.js already exists, migration wizard exited.` )
@@ -50,7 +50,7 @@ export async function run(options: CliRunOptions = {}): Promise<void> {
50
50
frameworks : argTemplate ?? [ ] ,
51
51
uncommittedConfirmed : false ,
52
52
updateVscodeSettings : true ,
53
- lintScript : argLintScript ?? 'keep' ,
53
+ lint : argLint ?? 'keep' ,
54
54
}
55
55
56
56
if ( ! argSkipPrompt ) {
@@ -106,13 +106,13 @@ export async function run(options: CliRunOptions = {}): Promise<void> {
106
106
message : 'Update .vscode/settings.json for better VS Code experience?' ,
107
107
} )
108
108
} ,
109
- lintScript : async ( { results } ) => {
109
+ lint : async ( { results } ) => {
110
110
if ( ! results . uncommittedConfirmed )
111
111
return 'keep'
112
112
113
- const isArgLintScriptValid = argLintScript && [ 'keep' , 'check' , 'fix' ] . includes ( argLintScript )
114
- if ( isArgLintScriptValid )
115
- return argLintScript
113
+ const isArgLintValid = argLint && [ 'keep' , 'check' , 'fix' ] . includes ( argLint )
114
+ if ( isArgLintValid )
115
+ return argLint
116
116
117
117
const pkgPath = path . join ( process . cwd ( ) , 'package.json' )
118
118
const existingScript = fs . existsSync ( pkgPath )
0 commit comments