From c36755d1658f95214091810bd6b63c6a76e2f414 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Fri, 1 Mar 2024 13:03:23 -0600 Subject: [PATCH] chore: lint --- src/cmds/versions/create.ts | 8 ++++---- src/index.ts | 2 +- src/lib/apiError.ts | 4 ++-- src/lib/baseCommand.ts | 2 +- src/lib/castStringOptToBool.ts | 2 +- src/lib/prepareOas.ts | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cmds/versions/create.ts b/src/cmds/versions/create.ts index ce65ea18..72e90dd7 100644 --- a/src/cmds/versions/create.ts +++ b/src/cmds/versions/create.ts @@ -17,11 +17,11 @@ export interface Options extends CommonOptions { } export interface CommonOptions { - beta?: 'true' | 'false'; + beta?: 'false' | 'true'; codename?: string; - deprecated?: 'true' | 'false'; - hidden?: 'true' | 'false'; - main?: 'true' | 'false'; + deprecated?: 'false' | 'true'; + hidden?: 'false' | 'true'; + main?: 'false' | 'true'; } export default class CreateVersionCommand extends Command { diff --git a/src/index.ts b/src/index.ts index af2aab52..45f3b195 100644 --- a/src/index.ts +++ b/src/index.ts @@ -85,7 +85,7 @@ export default function rdme(rawProcessArgv: NodeJS.Process['argv']) { } try { - let cmdArgv: CommandOptions | CommandLineOptions; + let cmdArgv: CommandLineOptions | CommandOptions; let bin: Command; // Handling for `rdme help` and `rdme help ` cases. diff --git a/src/lib/apiError.ts b/src/lib/apiError.ts index f8d71c36..c03897b4 100644 --- a/src/lib/apiError.ts +++ b/src/lib/apiError.ts @@ -10,8 +10,8 @@ export interface APIErrorResponse { export default class APIError extends Error { code: string; - constructor(res: string | APIErrorResponse | { error: APIErrorResponse }) { - let err: string | APIErrorResponse; + constructor(res: APIErrorResponse | string | { error: APIErrorResponse }) { + let err: APIErrorResponse | string; // Special handling to for fetch `res` arguments where `res.error` will contain our API error // response. diff --git a/src/lib/baseCommand.ts b/src/lib/baseCommand.ts index bb20224a..64d5c8ac 100644 --- a/src/lib/baseCommand.ts +++ b/src/lib/baseCommand.ts @@ -10,7 +10,7 @@ import isCI from './isCI.js'; import { debug, info, warn } from './logger.js'; import loginFlow from './loginFlow.js'; -export type CommandOptions = ZeroAuthCommandOptions | AuthenticatedCommandOptions; +export type CommandOptions = AuthenticatedCommandOptions | ZeroAuthCommandOptions; export type AuthenticatedCommandOptions = Omit, 'key'> & { key: string; diff --git a/src/lib/castStringOptToBool.ts b/src/lib/castStringOptToBool.ts index 8ae2a955..6cf3c68e 100644 --- a/src/lib/castStringOptToBool.ts +++ b/src/lib/castStringOptToBool.ts @@ -6,7 +6,7 @@ import type { Options as UpdateOptions } from '../cmds/versions/update.js'; * and casts it to a boolean. */ export default function castStringOptToBool( - opt: 'true' | 'false' | undefined, + opt: 'false' | 'true' | undefined, optName: keyof CreateOptions | keyof UpdateOptions, ) { if (!opt) { diff --git a/src/lib/prepareOas.ts b/src/lib/prepareOas.ts index d33ede64..d85d28c0 100644 --- a/src/lib/prepareOas.ts +++ b/src/lib/prepareOas.ts @@ -12,7 +12,7 @@ import readdirRecursive from './readdirRecursive.js'; export type SpecFileType = OASNormalize['type']; -type SpecType = 'OpenAPI' | 'Swagger' | 'Postman'; +type SpecType = 'OpenAPI' | 'Postman' | 'Swagger'; interface FoundSpecFile { /** path to the spec file */ @@ -30,7 +30,7 @@ interface FileSelection { } // source: https://stackoverflow.com/a/58110124 -type Truthy = T extends false | '' | 0 | null | undefined ? never : T; +type Truthy = T extends '' | 0 | false | null | undefined ? never : T; function truthy(value: T): value is Truthy { return !!value; @@ -49,7 +49,7 @@ const capitalizeSpecType = (type: string) => */ export default async function prepareOas( path: string | undefined, - command: 'openapi' | 'openapi:convert' | 'openapi:inspect' | 'openapi:reduce' | 'openapi:validate', + command: 'openapi:convert' | 'openapi:inspect' | 'openapi:reduce' | 'openapi:validate' | 'openapi', opts: { /** * Optionally convert the supplied or discovered API definition to the latest OpenAPI release.