@@ -102,8 +102,12 @@ Available feature flags:
102102 If used without ${ cyan ( '--vitest' ) } , it will also add Nightwatch Component Testing.
103103 --eslint
104104 Add ESLint for code quality.
105- --eslint-with-prettier
105+ --eslint-with-oxlint
106+ Add ESLint for code quality, and use Oxlint to speed up the linting process.
107+ --eslint-with-prettier (Deprecated in favor of ${ cyan ( '--eslint --prettier' ) } )
106108 Add Prettier for code formatting in addition to ESLint.
109+ --prettier
110+ Add Prettier for code formatting.
107111
108112Unstable feature flags:
109113 --tests, --with-tests
@@ -115,20 +119,40 @@ async function init() {
115119 const cwd = process . cwd ( )
116120 const args = process . argv . slice ( 2 )
117121
118- // alias is not supported by parseArgs
119- const options = {
120- typescript : { type : 'boolean' } ,
121- ts : { type : 'boolean' } ,
122- 'with-tests' : { type : 'boolean' } ,
123- tests : { type : 'boolean' } ,
124- 'vue-router' : { type : 'boolean' } ,
125- router : { type : 'boolean' } ,
126- } as const
122+ // // alias is not supported by parseArgs so we declare all the flags altogether
123+ const flags = [
124+ 'default' ,
125+ 'typescript' ,
126+ 'ts' ,
127+ 'jsx' ,
128+ 'router' ,
129+ 'vue-router' ,
130+ 'pinia' ,
131+ 'vitest' ,
132+ 'cypress' ,
133+ 'playwright' ,
134+ 'nightwatch' ,
135+ 'eslint' ,
136+ 'eslint-with-oxlint' ,
137+ 'eslint-with-prettier' ,
138+ 'prettier' ,
139+ 'tests' ,
140+ 'with-tests' ,
141+ 'force' ,
142+ 'bare' ,
143+ 'help' ,
144+ 'version' ,
145+ ] as const
146+ type CLIOptions = {
147+ [ key in ( typeof flags ) [ number ] ] : { readonly type : 'boolean ' }
148+ }
149+ const options = Object . fromEntries ( flags . map ( ( key ) => [ key , { type : 'boolean' } ] ) ) as CLIOptions
127150
128151 const { values : argv , positionals } = parseArgs ( {
129152 args,
130153 options,
131- strict : false ,
154+ strict : true ,
155+ allowPositionals : true ,
132156 } )
133157
134158 if ( argv . help ) {
@@ -145,16 +169,21 @@ async function init() {
145169 const isFeatureFlagsUsed =
146170 typeof (
147171 argv . default ??
148- ( argv . ts || argv . typescript ) ??
172+ argv . ts ??
173+ argv . typescript ??
149174 argv . jsx ??
150- ( argv . router || argv [ 'vue-router' ] ) ??
175+ argv . router ??
176+ argv [ 'vue-router' ] ??
151177 argv . pinia ??
152- ( argv . tests || argv [ 'with-tests' ] ) ??
178+ argv . tests ??
179+ argv [ 'with-tests' ] ??
153180 argv . vitest ??
154181 argv . cypress ??
155182 argv . nightwatch ??
156183 argv . playwright ??
157184 argv . eslint ??
185+ argv . prettier ??
186+ argv [ 'eslint-with-oxlint' ] ??
158187 argv [ 'eslint-with-prettier' ]
159188 ) === 'boolean'
160189
@@ -335,12 +364,7 @@ async function init() {
335364 } ,
336365 {
337366 name : 'needsPrettier' ,
338- type : ( prev , values ) => {
339- if ( isFeatureFlagsUsed || ! values . needsEslint ) {
340- return null
341- }
342- return 'toggle'
343- } ,
367+ type : ( ) => ( isFeatureFlagsUsed ? null : 'toggle' ) ,
344368 message : language . needsPrettier . message ,
345369 initial : false ,
346370 active : language . defaultToggleOptions . active ,
@@ -363,17 +387,21 @@ async function init() {
363387 const {
364388 projectName,
365389 packageName = projectName ?? defaultProjectName ,
366- shouldOverwrite = argv . force ,
367- needsJsx = argv . jsx ,
390+ shouldOverwrite = argv . force as boolean ,
391+ needsJsx = argv . jsx as boolean ,
368392 needsTypeScript = ( argv . ts || argv . typescript ) as boolean ,
369393 needsRouter = ( argv . router || argv [ 'vue-router' ] ) as boolean ,
370- needsPinia = argv . pinia ,
371- needsVitest = argv . vitest || argv . tests ,
372- needsPrettier = argv [ 'eslint-with-prettier' ] ,
394+ needsPinia = argv . pinia as boolean ,
395+ needsVitest = ( argv . vitest || argv . tests ) as boolean ,
396+ needsPrettier = ( argv . prettier || argv [ 'eslint-with-prettier' ] ) as boolean ,
373397 } = result
374398
375- const needsEslint = Boolean ( argv . eslint || argv [ 'eslint-with-prettier' ] || result . needsEslint )
376- const needsOxlint = result . needsEslint === 'speedUpWithOxlint'
399+ const needsEslint = Boolean (
400+ argv . eslint || argv [ 'eslint-with-oxlint' ] || argv [ 'eslint-with-prettier' ] || result . needsEslint ,
401+ )
402+ const needsOxlint = Boolean (
403+ argv [ 'eslint-with-oxlint' ] || result . needsEslint === 'speedUpWithOxlint' ,
404+ )
377405
378406 const { needsE2eTesting } = result
379407 const needsCypress = argv . cypress || argv . tests || needsE2eTesting === 'cypress'
0 commit comments