Skip to content

Commit b85ed4a

Browse files
committed
chore: fix or suppress linter warnings
1 parent 127185c commit b85ed4a

49 files changed

Lines changed: 192 additions & 166 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.json
2+
*.md
3+
*.yml
4+
*.jsonc

examples/basic/autocomplete-multiselect.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ${color.cyan('Filter and select multiple items in a single interface:')}
2121
- Press ${color.yellow('Enter')} when done selecting all items
2222
- Press ${color.yellow('Ctrl+C')} to cancel
2323
`,
24-
'Instructions'
24+
'Instructions',
2525
);
2626

2727
// Frameworks in alphabetical order
@@ -80,7 +80,7 @@ ${color.cyan('Filter and select multiple items in a single interface:')}
8080
// Display selected frameworks with detailed information
8181
p.note(
8282
`You selected ${color.green(selectedFrameworks.length)} frameworks:`,
83-
'Selection Complete'
83+
'Selection Complete',
8484
);
8585

8686
// Show each selected framework with its details

examples/basic/autocomplete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ${color.cyan('This example demonstrates the type-ahead autocomplete feature:')}
1414
- Press ${color.yellow('Enter')} to select the highlighted option
1515
- Press ${color.yellow('Ctrl+C')} to cancel
1616
`,
17-
'Instructions'
17+
'Instructions',
1818
);
1919

2020
const countries = [

examples/basic/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async function main() {
7373
p.cancel('Operation cancelled.');
7474
process.exit(0);
7575
},
76-
}
76+
},
7777
);
7878

7979
if (project.install) {

examples/basic/spinner-cancel-advanced.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function main() {
5656
onCancel: () => {
5757
p.note(
5858
'You cancelled during processing. Any completed work will be saved.',
59-
'Processing Cancelled'
59+
'Processing Cancelled',
6060
);
6161
},
6262
});
@@ -114,7 +114,7 @@ async function main() {
114114
onCancel: () => {
115115
p.note(
116116
'Final operation was cancelled, but processing results are still valid.',
117-
'Final Stage Cancelled'
117+
'Final Stage Cancelled',
118118
);
119119
},
120120
});

examples/basic/stream.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async function main() {
2222
await setTimeout(1000);
2323
}
2424
}
25-
})()
25+
})(),
2626
);
2727

2828
p.outro(`Problems? ${color.underline(color.cyan('https://example.com/issues'))}`);

examples/changesets/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function main() {
5656
const major = Array.isArray(results.major) ? results.major : [];
5757
const minor = Array.isArray(results.minor) ? results.minor : [];
5858
const possiblePackages = packages.filter(
59-
(pkg) => !major.includes(pkg) && !minor.includes(pkg)
59+
(pkg) => !major.includes(pkg) && !minor.includes(pkg),
6060
);
6161
if (possiblePackages.length === 0) return;
6262
const note = possiblePackages.join(color.dim(', '));
@@ -67,7 +67,7 @@ async function main() {
6767
},
6868
{
6969
onCancel,
70-
}
70+
},
7171
);
7272

7373
const message = await p.multiline({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"pretest": "pnpm run build"
1313
},
1414
"devDependencies": {
15-
"@bomb.sh/tools": "^0.4.2",
15+
"@bomb.sh/tools": "https://pkg.pr.new/@bomb.sh/tools@175116f",
1616
"@changesets/cli": "^2.29.5",
1717
"@types/node": "^20.19.39",
1818
"jsr": "^0.13.4",

packages/core/src/prompts/autocomplete.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type FilterFunction<T extends OptionLike> = (search: string, opt: T) => boolean;
1313

1414
function getCursorForValue<T extends OptionLike>(
1515
selected: T['value'] | undefined,
16-
items: T[]
16+
items: T[],
1717
): number {
1818
if (selected === undefined) {
1919
return 0;
@@ -46,8 +46,10 @@ function normalisedValue<T>(multiple: boolean, values: T[] | undefined): T | T[]
4646
return values[0];
4747
}
4848

49-
export interface AutocompleteOptions<T extends OptionLike>
50-
extends PromptOptions<T['value'] | T['value'][], AutocompletePrompt<T>> {
49+
export interface AutocompleteOptions<T extends OptionLike> extends PromptOptions<
50+
T['value'] | T['value'][],
51+
AutocompletePrompt<T>
52+
> {
5153
options: T[] | ((this: AutocompletePrompt<T>) => T[]);
5254
filter?: FilterFunction<T>;
5355
multiple?: boolean;
@@ -60,9 +62,7 @@ export interface AutocompleteOptions<T extends OptionLike>
6062
placeholder?: string;
6163
}
6264

63-
export class AutocompletePrompt<T extends OptionLike> extends Prompt<
64-
T['value'] | T['value'][]
65-
> {
65+
export class AutocompletePrompt<T extends OptionLike> extends Prompt<T['value'] | T['value'][]> {
6666
filteredOptions: T[];
6767
multiple: boolean;
6868
isNavigating = false;
@@ -162,7 +162,7 @@ export class AutocompletePrompt<T extends OptionLike> extends Prompt<
162162
placeholder !== undefined &&
163163
placeholder !== '' &&
164164
options.some(
165-
(opt) => !opt.disabled && (this.#filterFn ? this.#filterFn(placeholder, opt) : true)
165+
(opt) => !opt.disabled && (this.#filterFn ? this.#filterFn(placeholder, opt) : true),
166166
);
167167
if (key.name === 'tab' && isEmptyOrOnlyTab && placeholderMatchesOption) {
168168
if (this.userInput === '\t') {

packages/core/src/prompts/date.ts

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,20 @@ function toDate(parts: DateParts): Date | undefined {
7878
return p ? new Date(Date.UTC(p.year, p.month - 1, p.day)) : undefined;
7979
}
8080

81+
function toParts(date: Date | undefined): { year: number; month: number; day: number } | null {
82+
return date
83+
? { year: date.getUTCFullYear(), month: date.getUTCMonth() + 1, day: date.getUTCDate() }
84+
: null;
85+
}
86+
87+
// oxlint-disable-next-line max-params
8188
function segmentBounds(
8289
type: 'year' | 'month' | 'day',
8390
ctx: { year: number; month: number },
84-
minDate: Date | undefined,
85-
maxDate: Date | undefined
91+
dateConstraints: { minDate: Date | undefined; maxDate: Date | undefined },
8692
): { min: number; max: number } {
87-
const minP = minDate
88-
? {
89-
year: minDate.getUTCFullYear(),
90-
month: minDate.getUTCMonth() + 1,
91-
day: minDate.getUTCDate(),
92-
}
93-
: null;
94-
const maxP = maxDate
95-
? {
96-
year: maxDate.getUTCFullYear(),
97-
month: maxDate.getUTCMonth() + 1,
98-
day: maxDate.getUTCDate(),
99-
}
100-
: null;
93+
const minP = toParts(dateConstraints.minDate);
94+
const maxP = toParts(dateConstraints.maxDate);
10195

10296
if (type === 'year') {
10397
return { min: minP?.year ?? 1, max: maxP?.year ?? 9999 };
@@ -205,7 +199,7 @@ export class DatePrompt extends Prompt<Date> {
205199
if (!segment) return undefined;
206200
this.#cursor.positionInSegment = Math.max(
207201
0,
208-
Math.min(this.#cursor.positionInSegment, segment.len - 1)
202+
Math.min(this.#cursor.positionInSegment, segment.len - 1),
209203
);
210204
return { segment, index };
211205
}
@@ -217,7 +211,7 @@ export class DatePrompt extends Prompt<Date> {
217211
if (!ctx) return;
218212
this.#cursor.segmentIndex = Math.max(
219213
0,
220-
Math.min(this.#segments.length - 1, ctx.index + direction)
214+
Math.min(this.#segments.length - 1, ctx.index + direction),
221215
);
222216
this.#cursor.positionInSegment = 0;
223217
this.#segmentSelected = true;
@@ -230,12 +224,10 @@ export class DatePrompt extends Prompt<Date> {
230224
const raw = this.#segmentValues[segment.type];
231225
const isBlank = !raw || raw.replace(/_/g, '') === '';
232226
const num = Number.parseInt((raw || '0').replace(/_/g, '0'), 10) || 0;
233-
const bounds = segmentBounds(
234-
segment.type,
235-
parse(this.#segmentValues),
236-
this.#minDate,
237-
this.#maxDate
238-
);
227+
const bounds = segmentBounds(segment.type, parse(this.#segmentValues), {
228+
minDate: this.#minDate,
229+
maxDate: this.#maxDate,
230+
});
239231

240232
let next: number;
241233
if (isBlank) {

0 commit comments

Comments
 (0)