Skip to content

Commit

Permalink
apply new linting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
mikearnaldi committed Dec 27, 2023
1 parent 196b09e commit c5c987d
Show file tree
Hide file tree
Showing 77 changed files with 515 additions and 803 deletions.
11 changes: 2 additions & 9 deletions packages/cli/examples/naval-fate/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ import { pipe } from "effect/Function"
import * as Layer from "effect/Layer"
import * as Option from "effect/Option"
import * as ReadonlyArray from "effect/ReadonlyArray"
import {
CoordinatesOccupiedError,
Mine,
Ship,
ShipExistsError,
ShipNotFoundError
} from "./domain.js"
import { CoordinatesOccupiedError, Mine, Ship, ShipExistsError, ShipNotFoundError } from "./domain.js"

/**
* Represents the storage layer for the Naval Fate command-line application.
Expand Down Expand Up @@ -49,8 +43,7 @@ export const make = Effect.gen(function*($) {
Effect.map(Option.getOrElse<ReadonlyArray<Mine>>(() => [])),
Effect.orDie
)
const setShips = (ships: ReadonlyMap<string, Ship>) =>
shipsStore.set("ships", ships).pipe(Effect.orDie)
const setShips = (ships: ReadonlyMap<string, Ship>) => shipsStore.set("ships", ships).pipe(Effect.orDie)
const setMines = (mines: ReadonlyArray<Mine>) => minesStore.set("mines", mines).pipe(Effect.orDie)

const createShip: NavalFateStore["createShip"] = (name) =>
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/examples/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ const confirmPrompt = Prompt.confirm({

const datePrompt = Prompt.date({
message: "What's your birth day?",
dateMask:
"\"Year:\" YYYY, \"Month:\" MM, \"Day:\" DD \\\\\\\\||// \\Hour: HH, \\Minute: mm, \"Seconds:\" ss",
dateMask: "\"Year:\" YYYY, \"Month:\" MM, \"Day:\" DD \\\\\\\\||// \\Hour: HH, \\Minute: mm, \"Seconds:\" ss",
validate: (date) =>
date.getTime() > Date.now()
? Effect.fail("Your birth day can't be in the future")
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/Args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export declare namespace All {
/**
* @since 1.0.0
*/
export type ReturnIterable<T extends Iterable<ArgsAny>> = [T] extends
[Iterable<Args.Variance<infer A>>] ? Args<Array<A>>
export type ReturnIterable<T extends Iterable<ArgsAny>> = [T] extends [Iterable<Args.Variance<infer A>>] ?
Args<Array<A>>
: never

/**
Expand Down
15 changes: 5 additions & 10 deletions packages/cli/src/BuiltInOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,19 @@ export const isShowCompletions: (self: BuiltInOptions) => self is ShowCompletion
* @since 1.0.0
* @category refinements
*/
export const isShowHelp: (self: BuiltInOptions) => self is ShowHelp =
InternalBuiltInOptions.isShowHelp
export const isShowHelp: (self: BuiltInOptions) => self is ShowHelp = InternalBuiltInOptions.isShowHelp

/**
* @since 1.0.0
* @category refinements
*/
export const isShowWizard: (self: BuiltInOptions) => self is ShowWizard =
InternalBuiltInOptions.isShowWizard
export const isShowWizard: (self: BuiltInOptions) => self is ShowWizard = InternalBuiltInOptions.isShowWizard

/**
* @since 1.0.0
* @category refinements
*/
export const isShowVersion: (self: BuiltInOptions) => self is ShowVersion =
InternalBuiltInOptions.isShowVersion
export const isShowVersion: (self: BuiltInOptions) => self is ShowVersion = InternalBuiltInOptions.isShowVersion

/**
* @since 1.0.0
Expand All @@ -115,15 +112,13 @@ export const showCompletions: (shellType: BuiltInOptions.ShellType) => BuiltInOp
* @since 1.0.0
* @category constructors
*/
export const showHelp: (usage: Usage, helpDoc: HelpDoc) => BuiltInOptions =
InternalBuiltInOptions.showHelp
export const showHelp: (usage: Usage, helpDoc: HelpDoc) => BuiltInOptions = InternalBuiltInOptions.showHelp

/**
* @since 1.0.0
* @category constructors
*/
export const showWizard: (command: Command<unknown>) => BuiltInOptions =
InternalBuiltInOptions.showWizard
export const showWizard: (command: Command<unknown>) => BuiltInOptions = InternalBuiltInOptions.showWizard

/**
* @since 1.0.0
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/CliConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ export const defaultLayer: Layer.Layer<never, never, CliConfig> = InternalCliCon
* @since 1.0.0
* @category context
*/
export const layer: (config?: Partial<CliConfig>) => Layer.Layer<never, never, CliConfig> =
InternalCliConfig.layer
export const layer: (config?: Partial<CliConfig>) => Layer.Layer<never, never, CliConfig> = InternalCliConfig.layer

/**
* @since 1.0.0
Expand Down
7 changes: 2 additions & 5 deletions packages/cli/src/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ export type TypeId = typeof TypeId
* @since 1.0.0
* @category models
*/
export interface Command<Name extends string, R, E, A>
extends Pipeable, Effect<Command.Context<Name>, never, A>
{
export interface Command<Name extends string, R, E, A> extends Pipeable, Effect<Command.Context<Name>, never, A> {
readonly [TypeId]: TypeId
readonly descriptor: Descriptor.Command<A>
readonly handler: (_: A) => Effect<R, E, void>
Expand Down Expand Up @@ -204,8 +202,7 @@ export const getSubcommands: <Name extends string, R, E, A>(
* @since 1.0.0
* @category accessors
*/
export const getUsage: <Name extends string, R, E, A>(self: Command<Name, R, E, A>) => Usage =
Internal.getUsage
export const getUsage: <Name extends string, R, E, A>(self: Command<Name, R, E, A>) => Usage = Internal.getUsage

/**
* @since 1.0.0
Expand Down
20 changes: 8 additions & 12 deletions packages/cli/src/CommandDescriptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ export declare namespace Command {
* @since 1.0.0
* @category models
*/
export type ParsedStandardCommand<Name extends string, OptionsType, ArgsType> =
Command.ComputeParsedType<{
readonly name: Name
readonly options: OptionsType
readonly args: ArgsType
}>
export type ParsedStandardCommand<Name extends string, OptionsType, ArgsType> = Command.ComputeParsedType<{
readonly name: Name
readonly options: OptionsType
readonly args: ArgsType
}>

/**
* @since 1.0.0
Expand Down Expand Up @@ -97,8 +96,7 @@ export declare namespace Command {
export type Subcommands<
A extends NonEmptyReadonlyArray<readonly [id: unknown, command: Command<any>]>
> = {
[I in keyof A]: A[I] extends readonly [infer Id, Command<infer Value>]
? readonly [id: Id, value: Value]
[I in keyof A]: A[I] extends readonly [infer Id, Command<infer Value>] ? readonly [id: Id, value: Value]
: never
}[number]
}
Expand Down Expand Up @@ -146,8 +144,7 @@ export const getNames: <A>(self: Command<A>) => HashSet<string> = Internal.getNa
* @since 1.0.0
* @category combinators
*/
export const getSubcommands: <A>(self: Command<A>) => HashMap<string, Command<unknown>> =
Internal.getSubcommands
export const getSubcommands: <A>(self: Command<A>) => HashMap<string, Command<unknown>> = Internal.getSubcommands

/**
* @since 1.0.0
Expand Down Expand Up @@ -208,8 +205,7 @@ export const make: <Name extends string, OptionsType = void, ArgsType = void>(
name: Name,
options?: Options<OptionsType>,
args?: Args<ArgsType>
) => Command<{ readonly name: Name; readonly options: OptionsType; readonly args: ArgsType }> =
Internal.make
) => Command<{ readonly name: Name; readonly options: OptionsType; readonly args: ArgsType }> = Internal.make

/**
* @since 1.0.0
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/src/CommandDirective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ export interface UserDefined<A> {
* @since 1.0.0
* @category constructors
*/
export const builtIn: (option: BuiltInOptions) => CommandDirective<never> =
InternalCommandDirective.builtIn
export const builtIn: (option: BuiltInOptions) => CommandDirective<never> = InternalCommandDirective.builtIn

/**
* @since 1.0.0
* @category refinements
*/
export const isBuiltIn: <A>(self: CommandDirective<A>) => self is BuiltIn =
InternalCommandDirective.isBuiltIn
export const isBuiltIn: <A>(self: CommandDirective<A>) => self is BuiltIn = InternalCommandDirective.isBuiltIn

/**
* @since 1.0.0
Expand Down
9 changes: 3 additions & 6 deletions packages/cli/src/HelpDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,13 @@ export const isParagraph: (helpDoc: HelpDoc) => helpDoc is Paragraph = InternalH
* @since 1.0.0
* @category refinements
*/
export const isDescriptionList: (helpDoc: HelpDoc) => helpDoc is DescriptionList =
InternalHelpDoc.isDescriptionList
export const isDescriptionList: (helpDoc: HelpDoc) => helpDoc is DescriptionList = InternalHelpDoc.isDescriptionList

/**
* @since 1.0.0
* @category refinements
*/
export const isEnumeration: (helpDoc: HelpDoc) => helpDoc is Enumeration =
InternalHelpDoc.isEnumeration
export const isEnumeration: (helpDoc: HelpDoc) => helpDoc is Enumeration = InternalHelpDoc.isEnumeration

/**
* @since 1.0.0
Expand Down Expand Up @@ -163,8 +161,7 @@ export const descriptionList: (
* @since 1.0.0
* @category constructors
*/
export const enumeration: (elements: NonEmptyReadonlyArray<HelpDoc>) => HelpDoc =
InternalHelpDoc.enumeration
export const enumeration: (elements: NonEmptyReadonlyArray<HelpDoc>) => HelpDoc = InternalHelpDoc.enumeration

/**
* @since 1.0.0
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/src/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export declare namespace All {
/**
* @since 1.0.0
*/
export type ReturnIterable<T extends Iterable<OptionsAny>> = [T] extends
[Iterable<Options.Variance<infer A>>] ? Options<Array<A>>
export type ReturnIterable<T extends Iterable<OptionsAny>> = [T] extends [Iterable<Options.Variance<infer A>>] ?
Options<Array<A>>
: never

/**
Expand Down Expand Up @@ -221,8 +221,7 @@ export const directory: (name: string, config?: Options.PathOptionsConfig) => Op
* @since 1.0.0
* @category constructors
*/
export const file: (name: string, config?: Options.PathOptionsConfig) => Options<string> =
InternalOptions.file
export const file: (name: string, config?: Options.PathOptionsConfig) => Options<string> = InternalOptions.file

/**
* @since 1.0.0
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/src/Primitive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,13 @@ export const isBool: <A>(self: Primitive<A>) => boolean = InternalPrimitive.isBo
* @since 1.0.0
* @category constructors
*/
export const boolean: (defaultValue: Option<boolean>) => Primitive<boolean> =
InternalPrimitive.boolean
export const boolean: (defaultValue: Option<boolean>) => Primitive<boolean> = InternalPrimitive.boolean

/**
* @since 1.0.0
* @category constructors
*/
export const choice: <A>(alternatives: NonEmptyReadonlyArray<[string, A]>) => Primitive<A> =
InternalPrimitive.choice
export const choice: <A>(alternatives: NonEmptyReadonlyArray<[string, A]>) => Primitive<A> = InternalPrimitive.choice

/**
* Represents a date in ISO-8601 format, such as `2007-12-03T10:15:30`.
Expand Down
29 changes: 10 additions & 19 deletions packages/cli/src/Prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export type PromptTypeId = typeof PromptTypeId
* @since 1.0.0
* @category models
*/
export interface Prompt<Output>
extends Prompt.Variance<Output>, Pipeable, Effect<Terminal, QuitException, Output>
{}
export interface Prompt<Output> extends Prompt.Variance<Output>, Pipeable, Effect<Terminal, QuitException, Output> {}

/**
* @since 1.0.0
Expand Down Expand Up @@ -334,8 +332,8 @@ export declare namespace All {
/**
* @since 1.0.0
*/
export type ReturnIterable<T extends Iterable<PromptAny>> = [T] extends
[Iterable<Prompt.Variance<infer A>>] ? Prompt<Array<A>>
export type ReturnIterable<T extends Iterable<PromptAny>> = [T] extends [Iterable<Prompt.Variance<infer A>>] ?
Prompt<Array<A>>
: never

/**
Expand All @@ -349,8 +347,7 @@ export declare namespace All {
/**
* @since 1.0.0
*/
export type Return<Arg extends Iterable<PromptAny>> = [Arg] extends [ReadonlyArray<PromptAny>] ?
ReturnTuple<Arg>
export type Return<Arg extends Iterable<PromptAny>> = [Arg] extends [ReadonlyArray<PromptAny>] ? ReturnTuple<Arg>
: [Arg] extends [Iterable<PromptAny>] ? ReturnIterable<Arg>
: never
}
Expand All @@ -373,8 +370,7 @@ export const all: <
* @since 1.0.0
* @category constructors
*/
export const confirm: (options: Prompt.ConfirmOptions) => Prompt<boolean> =
InternalConfirmPrompt.confirm
export const confirm: (options: Prompt.ConfirmOptions) => Prompt<boolean> = InternalConfirmPrompt.confirm

/**
* Creates a custom `Prompt` from the provided `render` and `process` functions
Expand Down Expand Up @@ -433,15 +429,13 @@ export const hidden: (options: Prompt.TextOptions) => Prompt<Secret> = InternalT
* @since 1.0.0
* @category constructors
*/
export const integer: (options: Prompt.IntegerOptions) => Prompt<number> =
InternalNumberPrompt.integer
export const integer: (options: Prompt.IntegerOptions) => Prompt<number> = InternalNumberPrompt.integer

/**
* @since 1.0.0
* @category constructors
*/
export const list: (options: Prompt.ListOptions) => Prompt<ReadonlyArray<string>> =
InternalListPrompt.list
export const list: (options: Prompt.ListOptions) => Prompt<ReadonlyArray<string>> = InternalListPrompt.list

/**
* @since 1.0.0
Expand All @@ -464,15 +458,13 @@ export const password: (options: Prompt.TextOptions) => Prompt<Secret> = Interna
* @since 1.0.0
* @category execution
*/
export const run: <Output>(self: Prompt<Output>) => Effect<Terminal, QuitException, Output> =
InternalPrompt.run
export const run: <Output>(self: Prompt<Output>) => Effect<Terminal, QuitException, Output> = InternalPrompt.run

/**
* @since 1.0.0
* @category constructors
*/
export const select: <A>(options: Prompt.SelectOptions<A>) => Prompt<A> =
InternalSelectPrompt.select
export const select: <A>(options: Prompt.SelectOptions<A>) => Prompt<A> = InternalSelectPrompt.select

/**
* Creates a `Prompt` which immediately succeeds with the specified value.
Expand All @@ -495,5 +487,4 @@ export const text: (options: Prompt.TextOptions) => Prompt<string> = InternalTex
* @since 1.0.0
* @category constructors
*/
export const toggle: (options: Prompt.ToggleOptions) => Prompt<boolean> =
InternalTogglePrompt.toggle
export const toggle: (options: Prompt.ToggleOptions) => Prompt<boolean> = InternalTogglePrompt.toggle
6 changes: 2 additions & 4 deletions packages/cli/src/Prompt/Action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ export const beep: PromptAction<never, never> = InternalPromptAction.beep
* @since 1.0.0
* @category constructors
*/
export const nextFrame: <State>(state: State) => PromptAction<State, never> =
InternalPromptAction.nextFrame
export const nextFrame: <State>(state: State) => PromptAction<State, never> = InternalPromptAction.nextFrame

/**
* @since 1.0.0
* @category constructors
*/
export const submit: <Output>(value: Output) => PromptAction<never, Output> =
InternalPromptAction.submit
export const submit: <Output>(value: Output) => PromptAction<never, Output> = InternalPromptAction.submit
3 changes: 1 addition & 2 deletions packages/cli/src/Usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ export const mixed: Usage = InternalUsage.mixed
* @since 1.0.0
* @category constructors
*/
export const named: (names: ReadonlyArray<string>, acceptedValues: Option<string>) => Usage =
InternalUsage.named
export const named: (names: ReadonlyArray<string>, acceptedValues: Option<string>) => Usage = InternalUsage.named

/**
* @since 1.0.0
Expand Down
Loading

0 comments on commit c5c987d

Please sign in to comment.