diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..ce137b6 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +*.json +*.md +*.yml +*.jsonc diff --git a/examples/basic/autocomplete-multiselect.ts b/examples/basic/autocomplete-multiselect.ts index c34420c..1630cca 100644 --- a/examples/basic/autocomplete-multiselect.ts +++ b/examples/basic/autocomplete-multiselect.ts @@ -21,7 +21,7 @@ ${color.cyan('Filter and select multiple items in a single interface:')} - Press ${color.yellow('Enter')} when done selecting all items - Press ${color.yellow('Ctrl+C')} to cancel `, - 'Instructions' + 'Instructions', ); // Frameworks in alphabetical order @@ -80,7 +80,7 @@ ${color.cyan('Filter and select multiple items in a single interface:')} // Display selected frameworks with detailed information p.note( `You selected ${color.green(selectedFrameworks.length)} frameworks:`, - 'Selection Complete' + 'Selection Complete', ); // Show each selected framework with its details diff --git a/examples/basic/autocomplete.ts b/examples/basic/autocomplete.ts index ea94ece..e3bee62 100644 --- a/examples/basic/autocomplete.ts +++ b/examples/basic/autocomplete.ts @@ -14,7 +14,7 @@ ${color.cyan('This example demonstrates the type-ahead autocomplete feature:')} - Press ${color.yellow('Enter')} to select the highlighted option - Press ${color.yellow('Ctrl+C')} to cancel `, - 'Instructions' + 'Instructions', ); const countries = [ diff --git a/examples/basic/index.ts b/examples/basic/index.ts index 0115d4a..bd30b9d 100644 --- a/examples/basic/index.ts +++ b/examples/basic/index.ts @@ -73,7 +73,7 @@ async function main() { p.cancel('Operation cancelled.'); process.exit(0); }, - } + }, ); if (project.install) { diff --git a/examples/basic/spinner-cancel-advanced.ts b/examples/basic/spinner-cancel-advanced.ts index cbf0927..eed0f43 100644 --- a/examples/basic/spinner-cancel-advanced.ts +++ b/examples/basic/spinner-cancel-advanced.ts @@ -56,7 +56,7 @@ async function main() { onCancel: () => { p.note( 'You cancelled during processing. Any completed work will be saved.', - 'Processing Cancelled' + 'Processing Cancelled', ); }, }); @@ -114,7 +114,7 @@ async function main() { onCancel: () => { p.note( 'Final operation was cancelled, but processing results are still valid.', - 'Final Stage Cancelled' + 'Final Stage Cancelled', ); }, }); diff --git a/examples/basic/stream.ts b/examples/basic/stream.ts index c87ad5b..db79a39 100644 --- a/examples/basic/stream.ts +++ b/examples/basic/stream.ts @@ -22,7 +22,7 @@ async function main() { await setTimeout(1000); } } - })() + })(), ); p.outro(`Problems? ${color.underline(color.cyan('https://example.com/issues'))}`); diff --git a/examples/changesets/index.ts b/examples/changesets/index.ts index cb9226d..23e7074 100644 --- a/examples/changesets/index.ts +++ b/examples/changesets/index.ts @@ -56,7 +56,7 @@ async function main() { const major = Array.isArray(results.major) ? results.major : []; const minor = Array.isArray(results.minor) ? results.minor : []; const possiblePackages = packages.filter( - (pkg) => !major.includes(pkg) && !minor.includes(pkg) + (pkg) => !major.includes(pkg) && !minor.includes(pkg), ); if (possiblePackages.length === 0) return; const note = possiblePackages.join(color.dim(', ')); @@ -67,7 +67,7 @@ async function main() { }, { onCancel, - } + }, ); const message = await p.multiline({ diff --git a/package.json b/package.json index ccaaee0..3d650f8 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "pretest": "pnpm run build" }, "devDependencies": { - "@bomb.sh/tools": "^0.4.2", + "@bomb.sh/tools": "https://pkg.pr.new/@bomb.sh/tools@175116f", "@changesets/cli": "^2.29.5", "@types/node": "^20.19.39", "jsr": "^0.13.4", diff --git a/packages/core/src/prompts/autocomplete.ts b/packages/core/src/prompts/autocomplete.ts index 210336e..a3cc405 100644 --- a/packages/core/src/prompts/autocomplete.ts +++ b/packages/core/src/prompts/autocomplete.ts @@ -13,7 +13,7 @@ type FilterFunction = (search: string, opt: T) => boolean; function getCursorForValue( selected: T['value'] | undefined, - items: T[] + items: T[], ): number { if (selected === undefined) { return 0; @@ -46,8 +46,10 @@ function normalisedValue(multiple: boolean, values: T[] | undefined): T | T[] return values[0]; } -export interface AutocompleteOptions - extends PromptOptions> { +export interface AutocompleteOptions extends PromptOptions< + T['value'] | T['value'][], + AutocompletePrompt +> { options: T[] | ((this: AutocompletePrompt) => T[]); filter?: FilterFunction; multiple?: boolean; @@ -60,9 +62,7 @@ export interface AutocompleteOptions placeholder?: string; } -export class AutocompletePrompt extends Prompt< - T['value'] | T['value'][] -> { +export class AutocompletePrompt extends Prompt { filteredOptions: T[]; multiple: boolean; isNavigating = false; @@ -162,7 +162,7 @@ export class AutocompletePrompt extends Prompt< placeholder !== undefined && placeholder !== '' && options.some( - (opt) => !opt.disabled && (this.#filterFn ? this.#filterFn(placeholder, opt) : true) + (opt) => !opt.disabled && (this.#filterFn ? this.#filterFn(placeholder, opt) : true), ); if (key.name === 'tab' && isEmptyOrOnlyTab && placeholderMatchesOption) { if (this.userInput === '\t') { diff --git a/packages/core/src/prompts/date.ts b/packages/core/src/prompts/date.ts index 30e4dc7..1371d30 100644 --- a/packages/core/src/prompts/date.ts +++ b/packages/core/src/prompts/date.ts @@ -78,26 +78,20 @@ function toDate(parts: DateParts): Date | undefined { return p ? new Date(Date.UTC(p.year, p.month - 1, p.day)) : undefined; } +function toParts(date: Date | undefined): { year: number; month: number; day: number } | null { + return date + ? { year: date.getUTCFullYear(), month: date.getUTCMonth() + 1, day: date.getUTCDate() } + : null; +} + +// oxlint-disable-next-line max-params function segmentBounds( type: 'year' | 'month' | 'day', ctx: { year: number; month: number }, - minDate: Date | undefined, - maxDate: Date | undefined + dateConstraints: { minDate: Date | undefined; maxDate: Date | undefined }, ): { min: number; max: number } { - const minP = minDate - ? { - year: minDate.getUTCFullYear(), - month: minDate.getUTCMonth() + 1, - day: minDate.getUTCDate(), - } - : null; - const maxP = maxDate - ? { - year: maxDate.getUTCFullYear(), - month: maxDate.getUTCMonth() + 1, - day: maxDate.getUTCDate(), - } - : null; + const minP = toParts(dateConstraints.minDate); + const maxP = toParts(dateConstraints.maxDate); if (type === 'year') { return { min: minP?.year ?? 1, max: maxP?.year ?? 9999 }; @@ -205,7 +199,7 @@ export class DatePrompt extends Prompt { if (!segment) return undefined; this.#cursor.positionInSegment = Math.max( 0, - Math.min(this.#cursor.positionInSegment, segment.len - 1) + Math.min(this.#cursor.positionInSegment, segment.len - 1), ); return { segment, index }; } @@ -217,7 +211,7 @@ export class DatePrompt extends Prompt { if (!ctx) return; this.#cursor.segmentIndex = Math.max( 0, - Math.min(this.#segments.length - 1, ctx.index + direction) + Math.min(this.#segments.length - 1, ctx.index + direction), ); this.#cursor.positionInSegment = 0; this.#segmentSelected = true; @@ -230,12 +224,10 @@ export class DatePrompt extends Prompt { const raw = this.#segmentValues[segment.type]; const isBlank = !raw || raw.replace(/_/g, '') === ''; const num = Number.parseInt((raw || '0').replace(/_/g, '0'), 10) || 0; - const bounds = segmentBounds( - segment.type, - parse(this.#segmentValues), - this.#minDate, - this.#maxDate - ); + const bounds = segmentBounds(segment.type, parse(this.#segmentValues), { + minDate: this.#minDate, + maxDate: this.#maxDate, + }); let next: number; if (isBlank) { diff --git a/packages/core/src/prompts/group-multiselect.ts b/packages/core/src/prompts/group-multiselect.ts index fa1b1fa..529424a 100644 --- a/packages/core/src/prompts/group-multiselect.ts +++ b/packages/core/src/prompts/group-multiselect.ts @@ -1,7 +1,9 @@ import { Prompt, type PromptOptions } from './prompt.js'; -export interface GroupMultiSelectOptions - extends PromptOptions> { +export interface GroupMultiSelectOptions extends PromptOptions< + T['value'][], + GroupMultiSelectPrompt +> { options: Record; initialValues?: T['value'][]; required?: boolean; @@ -36,7 +38,7 @@ export class GroupMultiSelectPrompt extends Prompt groupedItems.findIndex((i) => i.value === v) === -1 + (v: string) => groupedItems.findIndex((i) => i.value === v) === -1, ); } else { this.value = [...this.value, ...groupedItems.map((i) => i.value)]; @@ -61,7 +63,7 @@ export class GroupMultiSelectPrompt extends Prompt value === opts.cursorAt), - this.#selectableGroups ? 0 : 1 + this.#selectableGroups ? 0 : 1, ); this.on('cursor', (key) => { diff --git a/packages/core/src/prompts/multi-line.ts b/packages/core/src/prompts/multi-line.ts index adf7505..81feb76 100644 --- a/packages/core/src/prompts/multi-line.ts +++ b/packages/core/src/prompts/multi-line.ts @@ -38,7 +38,7 @@ export class MultiLinePrompt extends Prompt { return; } this._setUserInput( - this.userInput.slice(0, this.cursor) + char + this.userInput.slice(this.cursor) + this.userInput.slice(0, this.cursor) + char + this.userInput.slice(this.cursor), ); } #handleCursor(key?: Action) { @@ -73,7 +73,7 @@ export class MultiLinePrompt extends Prompt { if (wasReturn) { if (this.userInput[this.cursor - 1] === '\n') { this._setUserInput( - this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor) + this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor), ); this._cursor--; } @@ -103,14 +103,14 @@ export class MultiLinePrompt extends Prompt { this.#lastKeyWasReturn = false; if (key?.name === 'backspace' && this.cursor > 0) { this._setUserInput( - this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor) + this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor), ); this._cursor--; return; } if (key?.name === 'delete' && this.cursor < this.userInput.length) { this._setUserInput( - this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1) + this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1), ); return; } diff --git a/packages/core/src/prompts/multi-select.ts b/packages/core/src/prompts/multi-select.ts index 9c29edf..7a831aa 100644 --- a/packages/core/src/prompts/multi-select.ts +++ b/packages/core/src/prompts/multi-select.ts @@ -6,8 +6,10 @@ interface OptionLike { disabled?: boolean; } -export interface MultiSelectOptions - extends PromptOptions> { +export interface MultiSelectOptions extends PromptOptions< + T['value'][], + MultiSelectPrompt +> { options: T[]; initialValues?: T['value'][]; required?: boolean; @@ -57,7 +59,7 @@ export class MultiSelectPrompt extends Prompt value === opts.cursorAt), - 0 + 0, ); this.cursor = this.options[cursor].disabled ? findCursor(cursor, 1, this.options) : cursor; this.on('key', (char) => { diff --git a/packages/core/src/prompts/prompt.ts b/packages/core/src/prompts/prompt.ts index 777120e..193164a 100644 --- a/packages/core/src/prompts/prompt.ts +++ b/packages/core/src/prompts/prompt.ts @@ -70,7 +70,7 @@ export class Prompt { */ private setSubscriber>( event: T, - opts: { cb: ClackEvents[T]; once?: boolean } + opts: { cb: ClackEvents[T]; once?: boolean }, ) { const params = this._subscribers.get(event) ?? []; params.push(opts); @@ -136,7 +136,7 @@ export class Prompt { this.state = 'cancel'; this.close(); }, - { once: true } + { once: true }, ); } diff --git a/packages/core/src/prompts/select-key.ts b/packages/core/src/prompts/select-key.ts index 0d4338a..560bde2 100644 --- a/packages/core/src/prompts/select-key.ts +++ b/packages/core/src/prompts/select-key.ts @@ -1,7 +1,9 @@ import { Prompt, type PromptOptions } from './prompt.js'; -export interface SelectKeyOptions - extends PromptOptions> { +export interface SelectKeyOptions extends PromptOptions< + T['value'], + SelectKeyPrompt +> { options: T[]; caseSensitive?: boolean; } diff --git a/packages/core/src/prompts/select.ts b/packages/core/src/prompts/select.ts index 418d568..4b1faae 100644 --- a/packages/core/src/prompts/select.ts +++ b/packages/core/src/prompts/select.ts @@ -1,14 +1,14 @@ import { findCursor } from '../utils/cursor.js'; import { Prompt, type PromptOptions } from './prompt.js'; -export interface SelectOptions - extends PromptOptions> { +export interface SelectOptions extends PromptOptions< + T['value'], + SelectPrompt +> { options: T[]; initialValue?: T['value']; } -export class SelectPrompt extends Prompt< - T['value'] -> { +export class SelectPrompt extends Prompt { options: T[]; cursor = 0; diff --git a/packages/core/src/utils/cursor.ts b/packages/core/src/utils/cursor.ts index 75df1ac..5925258 100644 --- a/packages/core/src/utils/cursor.ts +++ b/packages/core/src/utils/cursor.ts @@ -1,7 +1,8 @@ +// oxlint-disable-next-line max-params export function findCursor( cursor: number, delta: number, - options: T[] + options: T[], ) { const hasEnabledOptions = options.some((opt) => !opt.disabled); if (!hasEnabledOptions) { @@ -17,11 +18,12 @@ export function findCursor( return clampedCursor; } +// oxlint-disable-next-line max-params export function findTextCursor( cursor: number, deltaX: number, deltaY: number, - value: string + value: string, ): number { const lines = value.split('\n'); let cursorY = 0; diff --git a/packages/core/src/utils/index.ts b/packages/core/src/utils/index.ts index b221572..48d009c 100644 --- a/packages/core/src/utils/index.ts +++ b/packages/core/src/utils/index.ts @@ -98,12 +98,13 @@ export const getRows = (output: Writable): number => { return 20; }; +// oxlint-disable-next-line max-params export function wrapTextWithPrefix( output: Writable | undefined, text: string, prefix: string, startPrefix: string = prefix, - lineFormatter?: (line: string, index: number) => string + lineFormatter?: (line: string, index: number) => string, ): string { const columns = getColumns(output ?? stdout); const wrapped = wrapAnsi(text, columns - prefix.length, { diff --git a/packages/core/test/mock-writable.ts b/packages/core/test/mock-writable.ts index 746b0a0..c1f17bd 100644 --- a/packages/core/test/mock-writable.ts +++ b/packages/core/test/mock-writable.ts @@ -6,7 +6,7 @@ export class MockWritable extends Writable { _write( chunk: any, _encoding: BufferEncoding, - callback: (error?: Error | null | undefined) => void + callback: (error?: Error | null | undefined) => void, ): void { this.buffer.push(chunk.toString()); callback(); diff --git a/packages/core/test/prompts/autocomplete.test.ts b/packages/core/test/prompts/autocomplete.test.ts index f1d98e2..5ccd077 100644 --- a/packages/core/test/prompts/autocomplete.test.ts +++ b/packages/core/test/prompts/autocomplete.test.ts @@ -1,6 +1,6 @@ import { cursor } from 'sisteransi'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; -import { default as AutocompletePrompt } from '../../src/prompts/autocomplete.js'; +import { AutocompletePrompt } from '../../src/prompts/autocomplete.js'; import { MockReadable } from '../mock-readable.js'; import { MockWritable } from '../mock-writable.js'; diff --git a/packages/core/test/prompts/confirm.test.ts b/packages/core/test/prompts/confirm.test.ts index 8ad14c5..d6d2a6a 100644 --- a/packages/core/test/prompts/confirm.test.ts +++ b/packages/core/test/prompts/confirm.test.ts @@ -1,6 +1,6 @@ import { cursor } from 'sisteransi'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; -import { default as ConfirmPrompt } from '../../src/prompts/confirm.js'; +import { ConfirmPrompt } from '../../src/prompts/confirm.js'; import { MockReadable } from '../mock-readable.js'; import { MockWritable } from '../mock-writable.js'; diff --git a/packages/core/test/prompts/date.test.ts b/packages/core/test/prompts/date.test.ts index 8f3ce7e..4d2c138 100644 --- a/packages/core/test/prompts/date.test.ts +++ b/packages/core/test/prompts/date.test.ts @@ -1,6 +1,6 @@ import { cursor } from 'sisteransi'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; -import { default as DatePrompt } from '../../src/prompts/date.js'; +import { DatePrompt } from '../../src/prompts/date.js'; import { isCancel } from '../../src/utils/index.js'; import { MockReadable } from '../mock-readable.js'; import { MockWritable } from '../mock-writable.js'; diff --git a/packages/core/test/prompts/multi-line.test.ts b/packages/core/test/prompts/multi-line.test.ts index 53f86a5..74d3479 100644 --- a/packages/core/test/prompts/multi-line.test.ts +++ b/packages/core/test/prompts/multi-line.test.ts @@ -1,7 +1,7 @@ import { styleText } from 'node:util'; import { cursor } from 'sisteransi'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; -import { default as MultiLinePrompt } from '../../src/prompts/multi-line.js'; +import { MultiLinePrompt } from '../../src/prompts/multi-line.js'; import { MockReadable } from '../mock-readable.js'; import { MockWritable } from '../mock-writable.js'; diff --git a/packages/core/test/prompts/multi-select.test.ts b/packages/core/test/prompts/multi-select.test.ts index 9969579..41fe12b 100644 --- a/packages/core/test/prompts/multi-select.test.ts +++ b/packages/core/test/prompts/multi-select.test.ts @@ -1,6 +1,6 @@ import { cursor } from 'sisteransi'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; -import { default as MultiSelectPrompt } from '../../src/prompts/multi-select.js'; +import { MultiSelectPrompt } from '../../src/prompts/multi-select.js'; import { MockReadable } from '../mock-readable.js'; import { MockWritable } from '../mock-writable.js'; diff --git a/packages/core/test/prompts/password.test.ts b/packages/core/test/prompts/password.test.ts index 3b37e9d..025d420 100644 --- a/packages/core/test/prompts/password.test.ts +++ b/packages/core/test/prompts/password.test.ts @@ -1,7 +1,7 @@ import { styleText } from 'node:util'; import { cursor } from 'sisteransi'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; -import { default as PasswordPrompt } from '../../src/prompts/password.js'; +import { PasswordPrompt } from '../../src/prompts/password.js'; import { MockReadable } from '../mock-readable.js'; import { MockWritable } from '../mock-writable.js'; diff --git a/packages/core/test/prompts/prompt.test.ts b/packages/core/test/prompts/prompt.test.ts index bc4fa5e..f13a568 100644 --- a/packages/core/test/prompts/prompt.test.ts +++ b/packages/core/test/prompts/prompt.test.ts @@ -1,6 +1,6 @@ import { cursor } from 'sisteransi'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; -import { default as Prompt } from '../../src/prompts/prompt.js'; +import { Prompt } from '../../src/prompts/prompt.js'; import { isCancel } from '../../src/utils/index.js'; import { MockReadable } from '../mock-readable.js'; import { MockWritable } from '../mock-writable.js'; @@ -186,7 +186,7 @@ describe('Prompt', () => { output, render: () => 'foo', }, - false + false, ); instance.on('cursor', eventSpy); diff --git a/packages/core/test/prompts/select.test.ts b/packages/core/test/prompts/select.test.ts index a358306..b2e6c72 100644 --- a/packages/core/test/prompts/select.test.ts +++ b/packages/core/test/prompts/select.test.ts @@ -1,6 +1,6 @@ import { cursor } from 'sisteransi'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; -import { default as SelectPrompt } from '../../src/prompts/select.js'; +import { SelectPrompt } from '../../src/prompts/select.js'; import { MockReadable } from '../mock-readable.js'; import { MockWritable } from '../mock-writable.js'; diff --git a/packages/core/test/prompts/text.test.ts b/packages/core/test/prompts/text.test.ts index 91338a9..dbc3797 100644 --- a/packages/core/test/prompts/text.test.ts +++ b/packages/core/test/prompts/text.test.ts @@ -1,7 +1,7 @@ import { styleText } from 'node:util'; import { cursor } from 'sisteransi'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; -import { default as TextPrompt } from '../../src/prompts/text.js'; +import { TextPrompt } from '../../src/prompts/text.js'; import { MockReadable } from '../mock-readable.js'; import { MockWritable } from '../mock-writable.js'; diff --git a/packages/prompts/src/autocomplete.ts b/packages/prompts/src/autocomplete.ts index f840c71..c62c7b3 100644 --- a/packages/prompts/src/autocomplete.ts +++ b/packages/prompts/src/autocomplete.ts @@ -158,7 +158,7 @@ export const autocomplete = (opts: AutocompleteOptions) => { this.filteredOptions.length !== options.length ? styleText( 'dim', - ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? '' : 'es'})` + ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? '' : 'es'})`, ) : ''; @@ -177,7 +177,7 @@ export const autocomplete = (opts: AutocompleteOptions) => { headings.push( `${guidePrefix}${styleText('dim', 'Search:')}${searchText}${matches}`, ...noResults, - ...validationError + ...validationError, ); // Show instructions @@ -201,7 +201,7 @@ export const autocomplete = (opts: AutocompleteOptions) => { style: (option, active) => { return opt( option, - option.disabled ? 'disabled' : active ? 'active' : 'inactive' + option.disabled ? 'disabled' : active ? 'active' : 'inactive', ); }, maxItems: opts.maxItems, @@ -239,11 +239,12 @@ export interface AutocompleteMultiSelectOptions extends AutocompleteShare * Integrated autocomplete multiselect - combines type-ahead filtering with multiselect in one UI */ export const autocompleteMultiselect = (opts: AutocompleteMultiSelectOptions) => { + // oxlint-disable-next-line max-params const formatOption = ( option: Option, active: boolean, selectedValues: Value[], - focusedValue: Value | undefined + focusedValue: Value | undefined, ) => { const isSelected = selectedValues.includes(option.value); const label = option.label ?? String(option.value ?? ''); @@ -308,7 +309,7 @@ export const autocompleteMultiselect = (opts: AutocompleteMultiSelectOpti this.filteredOptions.length !== options.length ? styleText( 'dim', - ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? '' : 'es'})` + ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? '' : 'es'})`, ) : ''; @@ -317,13 +318,13 @@ export const autocompleteMultiselect = (opts: AutocompleteMultiSelectOpti case 'submit': { return `${title}${hasGuide ? `${styleText('gray', S_BAR)} ` : ''}${styleText( 'dim', - `${this.selectedValues.length} items selected` + `${this.selectedValues.length} items selected`, )}`; } case 'cancel': { return `${title}${hasGuide ? `${styleText('gray', S_BAR)} ` : ''}${styleText( ['strikethrough', 'dim'], - userInput + userInput, )}`; } default: { diff --git a/packages/prompts/src/box.ts b/packages/prompts/src/box.ts index e8f3b32..1f3955b 100644 --- a/packages/prompts/src/box.ts +++ b/packages/prompts/src/box.ts @@ -39,26 +39,25 @@ export interface BoxOptions extends CommonOptions { } function getPaddingForLine( - lineLength: number, - innerWidth: number, - padding: number, - contentAlign: BoxAlignment | undefined + sizes: { lineLength: number; innerWidth: number; padding: number }, + contentAlign: BoxAlignment | undefined, ): [number, number] { - let leftPadding = padding; - let rightPadding = padding; + let leftPadding = sizes.padding; + if (contentAlign === 'center') { - leftPadding = Math.floor((innerWidth - lineLength) / 2); + leftPadding = Math.floor((sizes.innerWidth - sizes.lineLength) / 2); } else if (contentAlign === 'right') { - leftPadding = innerWidth - lineLength - padding; + leftPadding = sizes.innerWidth - sizes.lineLength - sizes.padding; } - rightPadding = innerWidth - leftPadding - lineLength; + const rightPadding = sizes.innerWidth - leftPadding - sizes.lineLength; return [leftPadding, rightPadding]; } const defaultFormatBorder = (text: string) => text; +// oxlint-disable-next-line max-params export const box = (message = '', title = '', opts?: BoxOptions) => { const output: Writable = opts?.output ?? process.stdout; const columns = getColumns(output); @@ -103,28 +102,24 @@ export const box = (message = '', title = '', opts?: BoxOptions) => { const truncatedTitle = titleWidth > maxTitleLength ? `${title.slice(0, maxTitleLength - 3)}...` : title; const [titlePaddingLeft, titlePaddingRight] = getPaddingForLine( - stringWidth(truncatedTitle), - innerWidth, - titlePadding, - opts?.titleAlign + { lineLength: stringWidth(truncatedTitle), innerWidth, padding: titlePadding }, + opts?.titleAlign, ); const wrappedMessage = wrapAnsi(message, innerWidth - contentPadding * 2, { hard: true, trim: false, }); output.write( - `${linePrefix}${symbols[0]}${hSymbol.repeat(titlePaddingLeft)}${truncatedTitle}${hSymbol.repeat(titlePaddingRight)}${symbols[1]}\n` + `${linePrefix}${symbols[0]}${hSymbol.repeat(titlePaddingLeft)}${truncatedTitle}${hSymbol.repeat(titlePaddingRight)}${symbols[1]}\n`, ); const wrappedLines = wrappedMessage.split('\n'); for (const line of wrappedLines) { const [leftLinePadding, rightLinePadding] = getPaddingForLine( - stringWidth(line), - innerWidth, - contentPadding, - opts?.contentAlign + { lineLength: stringWidth(line), innerWidth, padding: contentPadding }, + opts?.contentAlign, ); output.write( - `${linePrefix}${vSymbol}${' '.repeat(leftLinePadding)}${line}${' '.repeat(rightLinePadding)}${vSymbol}\n` + `${linePrefix}${vSymbol}${' '.repeat(leftLinePadding)}${line}${' '.repeat(rightLinePadding)}${vSymbol}\n`, ); } output.write(`${linePrefix}${symbols[2]}${hSymbol.repeat(innerWidth)}${symbols[3]}\n`); diff --git a/packages/prompts/src/confirm.ts b/packages/prompts/src/confirm.ts index 75b322c..2c261e1 100644 --- a/packages/prompts/src/confirm.ts +++ b/packages/prompts/src/confirm.ts @@ -34,7 +34,7 @@ export const confirm = (opts: ConfirmOptions) => { opts.output, opts.message, titlePrefixBar, - titlePrefix + titlePrefix, ); const title = `${hasGuide ? `${styleText('gray', S_BAR)}\n` : ''}${messageLines}\n`; const value = this.value ? active : inactive; diff --git a/packages/prompts/src/group-multi-select.ts b/packages/prompts/src/group-multi-select.ts index 99c4dbf..cd7bd8c 100644 --- a/packages/prompts/src/group-multi-select.ts +++ b/packages/prompts/src/group-multi-select.ts @@ -22,6 +22,7 @@ export interface GroupMultiSelectOptions extends CommonOptions { } export const groupMultiselect = (opts: GroupMultiSelectOptions) => { const { selectableGroups = true, groupSpacing = 0 } = opts; + // oxlint-disable-next-line max-params const opt = ( option: Option & { group: string | boolean }, state: @@ -33,7 +34,7 @@ export const groupMultiselect = (opts: GroupMultiSelectOptions) => | 'group-active-selected' | 'submitted' | 'cancelled', - options: (Option & { group: string | boolean })[] = [] + options: (Option & { group: string | boolean })[] = [], ) => { const label = option.label ?? String(option.value); const isItem = typeof option.group === 'string'; @@ -98,9 +99,9 @@ export const groupMultiselect = (opts: GroupMultiSelectOptions) => 'dim', `Press ${styleText(['gray', 'bgWhite', 'inverse'], ' space ')} to select, ${styleText( 'gray', - styleText(['bgWhite', 'inverse'], ' enter ') - )} to submit` - ) + styleText(['bgWhite', 'inverse'], ' enter '), + )} to submit`, + ), )}`; }, render() { @@ -132,10 +133,11 @@ export const groupMultiselect = (opts: GroupMultiSelectOptions) => .map((ln, i) => i === 0 ? `${hasGuide ? `${styleText('yellow', S_BAR_END)} ` : ''}${styleText('yellow', ln)}` - : ` ${ln}` + : ` ${ln}`, ) .join('\n'); return `${title}${hasGuide ? `${styleText('yellow', S_BAR)} ` : ''}${this.options + // oxlint-disable-next-line max-params .map((option, i, options) => { const selected = value.includes(option.value) || @@ -160,6 +162,7 @@ export const groupMultiselect = (opts: GroupMultiSelectOptions) => } default: { const optionsText = this.options + // oxlint-disable-next-line max-params .map((option, i, options) => { const selected = value.includes(option.value) || @@ -174,7 +177,7 @@ export const groupMultiselect = (opts: GroupMultiSelectOptions) => optionText = opt( option, selected ? 'group-active-selected' : 'group-active', - options + options, ); } else if (active && selected) { optionText = opt(option, 'active-selected', options); diff --git a/packages/prompts/src/group.ts b/packages/prompts/src/group.ts index 25e7365..740e009 100644 --- a/packages/prompts/src/group.ts +++ b/packages/prompts/src/group.ts @@ -28,7 +28,7 @@ export type PromptGroup = { */ export const group = async ( prompts: PromptGroup, - opts?: PromptGroupOptions + opts?: PromptGroupOptions, ): Promise>> => { const results = {} as any; const promptNames = Object.keys(prompts); diff --git a/packages/prompts/src/limit-options.ts b/packages/prompts/src/limit-options.ts index f9b63d3..6fe4c10 100644 --- a/packages/prompts/src/limit-options.ts +++ b/packages/prompts/src/limit-options.ts @@ -14,18 +14,20 @@ export interface LimitOptionsParams extends CommonOptions { const trimLines = ( groups: Array, - initialLineCount: number, - startIndex: number, - endIndex: number, - maxLines: number + options: { + initialLineCount: number; + startIndex: number; + endIndex: number; + outputMaxItems: number; + }, ) => { - let lineCount = initialLineCount; + let lineCount = options.initialLineCount; let removals = 0; - for (let i = startIndex; i < endIndex; i++) { + for (let i = options.startIndex; i < options.endIndex; i++) { const group = groups[i]; lineCount = lineCount - group.length; removals++; - if (lineCount <= maxLines) { + if (lineCount <= options.outputMaxItems) { break; } } @@ -54,7 +56,7 @@ export const limitOptions = ({ if (cursor >= computedMaxItems - 3) { slidingWindowLocation = Math.max( Math.min(cursor - computedMaxItems + 3, options.length - computedMaxItems), - 0 + 0, ); } @@ -64,7 +66,7 @@ export const limitOptions = ({ const slidingWindowLocationEnd = Math.min( slidingWindowLocation + computedMaxItems, - options.length + options.length, ); const lineGroups: Array = []; let lineCount = 0; @@ -95,28 +97,33 @@ export const limitOptions = ({ let newLineCount = lineCount; const cursorGroupIndex = cursor - slidingWindowLocationWithEllipsis; const trimLinesLocal = (startIndex: number, endIndex: number) => - trimLines(lineGroups, newLineCount, startIndex, endIndex, outputMaxItems); + trimLines(lineGroups, { + initialLineCount: newLineCount, + startIndex, + endIndex, + outputMaxItems, + }); if (shouldRenderTopEllipsis) { ({ lineCount: newLineCount, removals: precedingRemovals } = trimLinesLocal( 0, - cursorGroupIndex + cursorGroupIndex, )); if (newLineCount > outputMaxItems) { ({ lineCount: newLineCount, removals: followingRemovals } = trimLinesLocal( cursorGroupIndex + 1, - lineGroups.length + lineGroups.length, )); } } else { ({ lineCount: newLineCount, removals: followingRemovals } = trimLinesLocal( cursorGroupIndex + 1, - lineGroups.length + lineGroups.length, )); if (newLineCount > outputMaxItems) { ({ lineCount: newLineCount, removals: precedingRemovals } = trimLinesLocal( 0, - cursorGroupIndex + cursorGroupIndex, )); } } diff --git a/packages/prompts/src/log.ts b/packages/prompts/src/log.ts index 2728d38..81f70d2 100644 --- a/packages/prompts/src/log.ts +++ b/packages/prompts/src/log.ts @@ -25,7 +25,7 @@ export const log = { output = process.stdout, spacing = 1, withGuide, - }: LogMessageOptions = {} + }: LogMessageOptions = {}, ) => { const parts: string[] = []; const hasGuide = withGuide ?? settings.withGuide; diff --git a/packages/prompts/src/multi-line.ts b/packages/prompts/src/multi-line.ts index 4eac8d8..e7f4262 100644 --- a/packages/prompts/src/multi-line.ts +++ b/packages/prompts/src/multi-line.ts @@ -42,7 +42,7 @@ export const multiline = (opts: MultiLineOptions) => { const submitPrefix = `${styleText('gray', S_BAR)} `; const lines = hasGuide ? wrapTextWithPrefix(opts.output, value, submitPrefix, undefined, (str) => - styleText('dim', str) + styleText('dim', str), ) : value ? styleText('dim', value) @@ -53,7 +53,7 @@ export const multiline = (opts: MultiLineOptions) => { const cancelPrefix = `${styleText('gray', S_BAR)} `; const lines = hasGuide ? wrapTextWithPrefix(opts.output, value, cancelPrefix, undefined, (str) => - styleText(['strikethrough', 'dim'], str) + styleText(['strikethrough', 'dim'], str), ) : value ? styleText(['strikethrough', 'dim'], value) diff --git a/packages/prompts/src/multi-select.ts b/packages/prompts/src/multi-select.ts index 28b27aa..085a256 100644 --- a/packages/prompts/src/multi-select.ts +++ b/packages/prompts/src/multi-select.ts @@ -38,7 +38,7 @@ export const multiselect = (opts: MultiSelectOptions) => { | 'active-selected' | 'submitted' | 'cancelled' - | 'disabled' + | 'disabled', ) => { const label = option.label ?? String(option.value); if (state === 'disabled') { @@ -87,9 +87,9 @@ export const multiselect = (opts: MultiSelectOptions) => { 'dim', `Press ${styleText(['gray', 'bgWhite', 'inverse'], ' space ')} to select, ${styleText( 'gray', - styleText('bgWhite', styleText('inverse', ' enter ')) - )} to submit` - ) + styleText('bgWhite', styleText('inverse', ' enter ')), + )} to submit`, + ), )}`; }, render() { @@ -98,7 +98,7 @@ export const multiselect = (opts: MultiSelectOptions) => { opts.output, opts.message, hasGuide ? `${symbolBar(this.state)} ` : '', - `${symbol(this.state)} ` + `${symbol(this.state)} `, ); const title = `${hasGuide ? `${styleText('gray', S_BAR)}\n` : ''}${wrappedMessage}\n`; const value = this.value ?? []; @@ -127,7 +127,7 @@ export const multiselect = (opts: MultiSelectOptions) => { const wrappedSubmitText = wrapTextWithPrefix( opts.output, submitText, - hasGuide ? `${styleText('gray', S_BAR)} ` : '' + hasGuide ? `${styleText('gray', S_BAR)} ` : '', ); return `${title}${wrappedSubmitText}`; } @@ -142,7 +142,7 @@ export const multiselect = (opts: MultiSelectOptions) => { const wrappedLabel = wrapTextWithPrefix( opts.output, label, - hasGuide ? `${styleText('gray', S_BAR)} ` : '' + hasGuide ? `${styleText('gray', S_BAR)} ` : '', ); return `${title}${wrappedLabel}${hasGuide ? `\n${styleText('gray', S_BAR)}` : ''}`; } @@ -153,7 +153,7 @@ export const multiselect = (opts: MultiSelectOptions) => { .map((ln, i) => i === 0 ? `${hasGuide ? `${styleText('yellow', S_BAR_END)} ` : ''}${styleText('yellow', ln)}` - : ` ${ln}` + : ` ${ln}`, ) .join('\n'); // Calculate rowPadding: title lines + footer lines (error message + trailing newline) diff --git a/packages/prompts/src/note.ts b/packages/prompts/src/note.ts index aa68d2b..4f39aed 100644 --- a/packages/prompts/src/note.ts +++ b/packages/prompts/src/note.ts @@ -22,6 +22,7 @@ export interface NoteOptions extends CommonOptions { const defaultNoteFormatter = (line: string): string => styleText('dim', line); +// oxlint-disable-next-line max-params const wrapWithFormat = (message: string, width: number, format: FormatFn): string => { const opts: WrapAnsiOptions = { hard: true, @@ -34,6 +35,7 @@ const wrapWithFormat = (message: string, width: number, format: FormatFn): strin return wrapAnsi(message, wrapWidth, opts); }; +// oxlint-disable-next-line max-params export const note = (message = '', title = '', opts?: NoteOptions) => { const output: Writable = opts?.output ?? process.stdout; const hasGuide = opts?.withGuide ?? settings.withGuide; @@ -47,12 +49,12 @@ export const note = (message = '', title = '', opts?: NoteOptions) => { const width = stringWidth(ln); return width > sum ? width : sum; }, 0), - titleLen + titleLen, ) + 2; const msg = lines .map( (ln) => - `${styleText('gray', S_BAR)} ${ln}${' '.repeat(len - stringWidth(ln))}${styleText('gray', S_BAR)}` + `${styleText('gray', S_BAR)} ${ln}${' '.repeat(len - stringWidth(ln))}${styleText('gray', S_BAR)}`, ) .join('\n'); const leadingBorder = hasGuide ? `${styleText('gray', S_BAR)}\n` : ''; @@ -60,7 +62,7 @@ export const note = (message = '', title = '', opts?: NoteOptions) => { output.write( `${leadingBorder}${styleText('green', S_STEP_SUBMIT)} ${styleText('reset', title)} ${styleText( 'gray', - S_BAR_H.repeat(Math.max(len - titleLen - 1, 1)) + S_CORNER_TOP_RIGHT - )}\n${msg}\n${styleText('gray', bottomLeft + S_BAR_H.repeat(len + 2) + S_CORNER_BOTTOM_RIGHT)}\n` + S_BAR_H.repeat(Math.max(len - titleLen - 1, 1)) + S_CORNER_TOP_RIGHT, + )}\n${msg}\n${styleText('gray', bottomLeft + S_BAR_H.repeat(len + 2) + S_CORNER_BOTTOM_RIGHT)}\n`, ); }; diff --git a/packages/prompts/src/path.ts b/packages/prompts/src/path.ts index 70b8618..a90d8da 100644 --- a/packages/prompts/src/path.ts +++ b/packages/prompts/src/path.ts @@ -1,4 +1,5 @@ import { existsSync, lstatSync, readdirSync } from 'node:fs'; +// oxlint-disable-next-line no-restricted-imports import { dirname, join } from 'node:path'; import { autocomplete } from './autocomplete.js'; import type { CommonOptions } from './common.js'; @@ -66,13 +67,13 @@ export const path = (opts: PathOptions) => { }; }) .filter( - ({ path, isDirectory }) => path.startsWith(prefix) && (isDirectory || !opts.directory) + ({ path, isDirectory }) => path.startsWith(prefix) && (isDirectory || !opts.directory), ); return items.map((item) => ({ value: item.path, })); - } catch (_e) { + } catch { return []; } }, diff --git a/packages/prompts/src/select-key.ts b/packages/prompts/src/select-key.ts index cceef81..0316a37 100644 --- a/packages/prompts/src/select-key.ts +++ b/packages/prompts/src/select-key.ts @@ -13,7 +13,7 @@ export interface SelectKeyOptions extends CommonOptions { export const selectKey = (opts: SelectKeyOptions) => { const opt = ( option: Option, - state: 'inactive' | 'active' | 'selected' | 'cancelled' = 'inactive' + state: 'inactive' | 'active' | 'selected' | 'cancelled' = 'inactive', ) => { const label = option.label ?? String(option.value); if (state === 'selected') { @@ -51,7 +51,7 @@ export const selectKey = (opts: SelectKeyOptions) = const wrapped = wrapTextWithPrefix( opts.output, opt(selectedOption, 'selected'), - submitPrefix + submitPrefix, ); return `${title}${wrapped}`; } @@ -60,7 +60,7 @@ export const selectKey = (opts: SelectKeyOptions) = const wrapped = wrapTextWithPrefix( opts.output, opt(this.options[0], 'cancelled'), - cancelPrefix + cancelPrefix, ); return `${title}${wrapped}${hasGuide ? `\n${styleText('gray', S_BAR)}` : ''}`; } @@ -72,8 +72,8 @@ export const selectKey = (opts: SelectKeyOptions) = wrapTextWithPrefix( opts.output, opt(option, i === this.cursor ? 'active' : 'inactive'), - defaultPrefix - ) + defaultPrefix, + ), ) .join('\n'); return `${title}${wrapped}\n${defaultPrefixEnd}\n`; diff --git a/packages/prompts/src/select.ts b/packages/prompts/src/select.ts index a3407cd..abf626e 100644 --- a/packages/prompts/src/select.ts +++ b/packages/prompts/src/select.ts @@ -85,7 +85,7 @@ const computeLabel = (label: string, format: (text: string) => string) => { export const select = (opts: SelectOptions) => { const opt = ( option: Option, - state: 'inactive' | 'active' | 'selected' | 'cancelled' | 'disabled' + state: 'inactive' | 'active' | 'selected' | 'cancelled' | 'disabled', ) => { const label = option.label ?? String(option.value); switch (state) { @@ -120,7 +120,7 @@ export const select = (opts: SelectOptions) => { opts.output, opts.message, titlePrefixBar, - titlePrefix + titlePrefix, ); const title = `${hasGuide ? `${styleText('gray', S_BAR)}\n` : ''}${messageLines}\n`; @@ -130,7 +130,7 @@ export const select = (opts: SelectOptions) => { const wrappedLines = wrapTextWithPrefix( opts.output, opt(this.options[this.cursor], 'selected'), - submitPrefix + submitPrefix, ); return `${title}${wrappedLines}`; } @@ -139,7 +139,7 @@ export const select = (opts: SelectOptions) => { const wrappedLines = wrapTextWithPrefix( opts.output, opt(this.options[this.cursor], 'cancelled'), - cancelPrefix + cancelPrefix, ); return `${title}${wrappedLines}${hasGuide ? `\n${styleText('gray', S_BAR)}` : ''}`; } diff --git a/packages/prompts/src/spinner.ts b/packages/prompts/src/spinner.ts index 9b427e3..2207ac1 100644 --- a/packages/prompts/src/spinner.ts +++ b/packages/prompts/src/spinner.ts @@ -170,6 +170,7 @@ export const spinner = ({ }, delay); }; + // oxlint-disable-next-line max-params const _stop = (msg = '', code = 0, silent: boolean = false): void => { if (!isSpinnerActive) return; isSpinnerActive = false; diff --git a/packages/prompts/src/stream.ts b/packages/prompts/src/stream.ts index 4ff3db5..e07dc2e 100644 --- a/packages/prompts/src/stream.ts +++ b/packages/prompts/src/stream.ts @@ -12,7 +12,7 @@ const prefix = `${styleText('gray', S_BAR)} `; export const stream = { message: async ( iterable: Iterable | AsyncIterable, - { symbol = styleText('gray', S_BAR) }: LogMessageOptions = {} + { symbol = styleText('gray', S_BAR) }: LogMessageOptions = {}, ) => { process.stdout.write(`${styleText('gray', S_BAR)}\n${symbol} `); let lineWidth = 3; diff --git a/packages/prompts/src/task-log.ts b/packages/prompts/src/task-log.ts index e69f220..4bc7eba 100644 --- a/packages/prompts/src/task-log.ts +++ b/packages/prompts/src/task-log.ts @@ -37,7 +37,7 @@ interface BufferEntry { } const stripDestructiveANSI = (input: string): string => { - // biome-ignore lint/suspicious/noControlCharactersInRegex: intentional + // oxlint-disable-next-line no-control-regex return input.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ''); }; @@ -105,6 +105,7 @@ export const taskLog = (opts: TaskLogOptions) => { output.write(erase.lines(lines)); } }; + // oxlint-disable-next-line max-params const printBuffer = (buffer: BufferEntry, messageSpacing?: number, full?: boolean): void => { const messages = full ? `${buffer.full}\n${buffer.value}` : buffer.value; if (buffer.header !== undefined && buffer.header !== '') { @@ -115,7 +116,7 @@ export const taskLog = (opts: TaskLogOptions) => { secondarySymbol, symbol: secondarySymbol, spacing: 0, - } + }, ); } log.message( @@ -125,7 +126,7 @@ export const taskLog = (opts: TaskLogOptions) => { secondarySymbol, symbol: secondarySymbol, spacing: messageSpacing ?? spacing, - } + }, ); }; const renderBuffer = (): void => { @@ -134,10 +135,18 @@ export const taskLog = (opts: TaskLogOptions) => { if ((header === undefined || header.length === 0) && value.length === 0) { continue; } - printBuffer(buffer, undefined, retainLog === true && full.length > 0); + printBuffer(buffer, undefined, retainLog && full.length > 0); } }; - const message = (buffer: BufferEntry, msg: string, mopts?: TaskLogMessageOptions) => { + const message = ({ + buffer, + msg, + mopts, + }: { + buffer: BufferEntry; + msg: string; + mopts?: TaskLogMessageOptions; + }) => { clear(false); if ((mopts?.raw !== true || !lastMessageWasRaw) && buffer.value !== '') { buffer.value += '\n'; @@ -184,7 +193,8 @@ export const taskLog = (opts: TaskLogOptions) => { return { message(msg: string, mopts?: TaskLogMessageOptions) { - message(buffers[0], msg, mopts); + const buffer = buffers[0]; + message({ buffer, msg, mopts }); }, group(name: string) { const buffer: BufferEntry = { @@ -195,7 +205,7 @@ export const taskLog = (opts: TaskLogOptions) => { buffers.push(buffer); return { message(msg: string, mopts?: TaskLogMessageOptions) { - message(buffer, msg, mopts); + message({ buffer, msg, mopts }); }, error(message: string) { completeBuffer(buffer, { diff --git a/packages/prompts/test/date.test.ts b/packages/prompts/test/date.test.ts index 5949005..fbf6a62 100644 --- a/packages/prompts/test/date.test.ts +++ b/packages/prompts/test/date.test.ts @@ -167,7 +167,7 @@ describe.each(['true', 'false'])('date (isCI = %s)', (isCI) => { await new Promise((r) => setImmediate(r)); const hasError = output.buffer.some( - (s) => typeof s === 'string' && s.includes('Date must be on or after') + (s) => typeof s === 'string' && s.includes('Date must be on or after'), ); expect(hasError).toBe(true); diff --git a/packages/prompts/test/path.test.ts b/packages/prompts/test/path.test.ts index 5c1fe1f..f2fef78 100644 --- a/packages/prompts/test/path.test.ts +++ b/packages/prompts/test/path.test.ts @@ -33,7 +33,7 @@ describe.each(['true', 'false'])('text (isCI = %s)', (isCI) => { './root.zip': '6', './bar': '7', }, - '/tmp' + '/tmp', ); }); diff --git a/packages/prompts/test/progress-bar.test.ts b/packages/prompts/test/progress-bar.test.ts index a64061c..c6215e4 100644 --- a/packages/prompts/test/progress-bar.test.ts +++ b/packages/prompts/test/progress-bar.test.ts @@ -325,7 +325,7 @@ describe.each(['true', 'false'])('prompts - progress (isCI = %s)', (isCI) => { result.stop(); expect(output.buffer).toMatchSnapshot(); - } + }, ); }); }); diff --git a/packages/prompts/test/test-utils.ts b/packages/prompts/test/test-utils.ts index 414ce24..4019176 100644 --- a/packages/prompts/test/test-utils.ts +++ b/packages/prompts/test/test-utils.ts @@ -9,7 +9,7 @@ export class MockWritable extends Writable { _write( chunk: any, _encoding: BufferEncoding, - callback: (error?: Error | null | undefined) => void + callback: (error?: Error | null | undefined) => void, ): void { this.buffer.push(chunk.toString()); callback(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8ef8fa1..86cb9fa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: devDependencies: '@bomb.sh/tools': - specifier: ^0.4.2 - version: 0.4.2(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)(@types/node@20.19.39)(jiti@2.6.1)(oxc-resolver@11.19.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0))(typescript@6.0.3)(yaml@2.8.3) + specifier: https://pkg.pr.new/@bomb.sh/tools@175116f + version: https://pkg.pr.new/@bomb.sh/tools@175116f(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)(@types/node@20.19.39)(jiti@2.6.1)(oxc-resolver@11.19.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0))(typescript@6.0.3)(yaml@2.8.3) '@changesets/cli': specifier: ^2.29.5 version: 2.29.5 @@ -113,8 +113,9 @@ packages: '@bomb.sh/args@0.3.1': resolution: {integrity: sha512-CwxKrfgcorUPP6KfYD59aRdBYWBTsfsxT+GmoLVnKo5Tmyoqbpo0UNcjngRMyU+6tiPbd18RuIYxhgAn44wU/Q==} - '@bomb.sh/tools@0.4.2': - resolution: {integrity: sha512-BbjMPPUhUG9ZM2lVbXiCfy5u+IDEDW5q++F3q/RQDiENhyaGqXk3HZhVFK4XqSRQ+fd4VO8KLzbQGdbis4XU2Q==} + '@bomb.sh/tools@https://pkg.pr.new/@bomb.sh/tools@175116f': + resolution: {integrity: sha512-W8WgNHwOJ1tSEFyw2FrqkHFdvGphxo2TXFXYVPmwoztlGW+fZSKHy4Wk3DP1Q4gMk0pqYttcgjwauj5hlTbJrQ==, tarball: https://pkg.pr.new/@bomb.sh/tools@175116f} + version: 0.4.2 hasBin: true '@changesets/apply-release-plan@7.0.12': @@ -1983,7 +1984,7 @@ snapshots: '@bomb.sh/args@0.3.1': {} - '@bomb.sh/tools@0.4.2(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)(@types/node@20.19.39)(jiti@2.6.1)(oxc-resolver@11.19.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0))(typescript@6.0.3)(yaml@2.8.3)': + '@bomb.sh/tools@https://pkg.pr.new/@bomb.sh/tools@175116f(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)(@types/node@20.19.39)(jiti@2.6.1)(oxc-resolver@11.19.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0))(typescript@6.0.3)(yaml@2.8.3)': dependencies: '@bomb.sh/args': 0.3.1 '@humanfs/node': 0.16.7