Skip to content

Commit

Permalink
refactor(create): fix all eslint warnings in the plugin
Browse files Browse the repository at this point in the history
Was annoying me how many there were in this file in particular.
  • Loading branch information
ivomurrell committed Mar 21, 2023
1 parent 7e99bf5 commit 2839333
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions core/create/src/prompts/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { z } from 'zod'
interface OptionSettings {
name: string
type: z.ZodTypeAny
default?: any
default?: unknown
}

async function optionsPromptForPlugin(
Expand Down Expand Up @@ -118,10 +118,12 @@ async function optionsPromptForPlugin(
{
name: 'option',
type: 'multiselect',
choices: (elementType as z.ZodEnum<any>).options.map((choice: string) => ({
title: choice,
value: choice
})),
choices: (elementType as z.ZodEnum<[string, ...string[]]>).options.map(
(choice: string) => ({
title: choice,
value: choice
})
),
message: `Select options for '${styles.option(optionName)}'` + defaultSuffix
},
{ onCancel }
Expand All @@ -137,7 +139,7 @@ async function optionsPromptForPlugin(
{
name: 'option',
type: 'select',
choices: (optionType as z.ZodEnum<any>).options.map((choice: string) => ({
choices: (optionType as z.ZodEnum<[string, ...string[]]>).options.map((choice: string) => ({
title: choice,
value: choice
})),
Expand Down Expand Up @@ -223,6 +225,9 @@ export default async ({ logger, config, toolKitConfig, configPath }: OptionsPara
}
if (!cancelled && generators) {
for (const [optionName, generator] of Object.entries(generators)) {
// the object is partial because not all options for a plugin will
// have generators, but all values in the record will be defined
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
toolKitConfig.options[plugin][optionName] = await generator!(
winstonLogger.child({ plugin }),
prompt,
Expand Down

0 comments on commit 2839333

Please sign in to comment.