Skip to content

Commit 9a4b67e

Browse files
committed
chore: update prettier
1 parent b3aa049 commit 9a4b67e

File tree

19 files changed

+106
-104
lines changed

19 files changed

+106
-104
lines changed

examples/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<title>Consola</title>

examples/index.legacy.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<title>Consola</title>

examples/special.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ consola.error(undefined, null, false, true, Number.NaN);
1919
consola.log("We can `monospace` keyword using grave accent charachter!");
2020

2121
consola.log(
22-
"We can also _underline_ words but not_this or this should_not_be_underlined!"
22+
"We can also _underline_ words but not_this or this should_not_be_underlined!",
2323
);
2424

2525
// Nonstandard error

examples/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ConsolaOptions, createConsola } from "../../src";
22
import { randomSentence } from "./sentence";
33

44
export function reporterDemo(
5-
opts: Partial<ConsolaOptions & { fancy: boolean }>
5+
opts: Partial<ConsolaOptions & { fancy: boolean }>,
66
) {
77
const consola = createConsola({
88
...opts,

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"is-unicode-supported": "^1.3.0",
8686
"jiti": "^1.18.2",
8787
"lodash": "^4.17.21",
88-
"prettier": "^2.8.8",
88+
"prettier": "^3.0.0",
8989
"sentencer": "^0.2.1",
9090
"sisteransi": "^1.0.5",
9191
"std-env": "^3.3.3",
@@ -98,4 +98,4 @@
9898
"node": "^14.18.0 || >=16.10.0"
9999
},
100100
"packageManager": "pnpm@8.6.5"
101-
}
101+
}

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/basic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ConsolaInstance, createConsola as _createConsola } from "./consola";
66
export * from "./shared";
77

88
export function createConsola(
9-
options: Partial<ConsolaOptions & { fancy: boolean }> = {}
9+
options: Partial<ConsolaOptions & { fancy: boolean }> = {},
1010
): ConsolaInstance {
1111
// Log level
1212
let level: LogLevel = LogLevels.info;

src/consola.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class Consola {
4444
colors: false,
4545
compact: true,
4646
},
47-
}
47+
},
4848
);
4949

5050
// Create logger functions for current instance
@@ -60,7 +60,7 @@ export class Consola {
6060
// @ts-expect-error
6161
(this as unknown as ConsolaInstance)[type].raw = this._wrapLogFn(
6262
defaults,
63-
true
63+
true,
6464
);
6565
}
6666

@@ -81,7 +81,7 @@ export class Consola {
8181
this.options.level = _normalizeLogLevel(
8282
level,
8383
this.options.types,
84-
this.options.level
84+
this.options.level,
8585
);
8686
}
8787

@@ -347,7 +347,7 @@ export class Consola {
347347
// Auto-resolve when throttle is timed out
348348
this._lastLog.timeout = setTimeout(
349349
resolveLog,
350-
this.options.throttle
350+
this.options.throttle,
351351
);
352352
return; // SPAM!
353353
}
@@ -372,7 +372,7 @@ export class Consola {
372372
function _normalizeLogLevel(
373373
input: LogLevel | LogType | undefined,
374374
types: any = {},
375-
defaultLevel = 3
375+
defaultLevel = 3,
376376
) {
377377
if (input === undefined) {
378378
return defaultLevel;
@@ -409,7 +409,7 @@ Consola.prototype.pause = Consola.prototype.pauseLogs;
409409
Consola.prototype.resume = Consola.prototype.resumeLogs;
410410

411411
export function createConsola(
412-
options: Partial<ConsolaOptions> = {}
412+
options: Partial<ConsolaOptions> = {},
413413
): ConsolaInstance {
414414
return new Consola(options) as ConsolaInstance;
415415
}

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { ConsolaInstance, createConsola as _createConsola } from "./consola";
88
export * from "./shared";
99

1010
export function createConsola(
11-
options: Partial<ConsolaOptions & { fancy: boolean }> = {}
11+
options: Partial<ConsolaOptions & { fancy: boolean }> = {},
1212
): ConsolaInstance {
1313
// Log level
1414
let level = _getDefaultLogLevel();

src/prompt.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ type inferPromptReturnType<T extends PromptOptions> = T extends TextOptions
5050
export async function prompt<
5151
_ = any,
5252
__ = any,
53-
T extends PromptOptions = TextOptions
53+
T extends PromptOptions = TextOptions,
5454
>(
5555
message: string,
56-
opts: PromptOptions = {}
56+
opts: PromptOptions = {},
5757
): Promise<inferPromptReturnType<T>> {
5858
if (!opts.type || opts.type === "text") {
5959
return (await text({
@@ -75,7 +75,7 @@ export async function prompt<
7575
return (await select({
7676
message,
7777
options: opts.options.map((o) =>
78-
typeof o === "string" ? { value: o, label: o } : o
78+
typeof o === "string" ? { value: o, label: o } : o,
7979
),
8080
})) as any;
8181
}
@@ -84,7 +84,7 @@ export async function prompt<
8484
return (await multiselect({
8585
message,
8686
options: opts.options.map((o) =>
87-
typeof o === "string" ? { value: o, label: o } : o
87+
typeof o === "string" ? { value: o, label: o } : o,
8888
),
8989
required: opts.required,
9090
})) as any;

src/reporters/basic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class BasicReporter implements ConsolaReporter {
7171
line + "\n",
7272
logObj.level < 2
7373
? ctx.options.stderr || process.stderr
74-
: ctx.options.stdout || process.stdout
74+
: ctx.options.stdout || process.stdout,
7575
);
7676
}
7777
}

src/reporters/browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class BrowserReporter {
6161
style,
6262
// Empty string as style resets to default console style
6363
"",
64-
...logObj.args.slice(1)
64+
...logObj.args.slice(1),
6565
);
6666
} else {
6767
consoleLogFn(badge, style, ...logObj.args);

src/reporters/fancy.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class FancyReporter extends BasicReporter {
5555
" " +
5656
line
5757
.replace(/^at +/, (m) => colors.gray(m))
58-
.replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`)
58+
.replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`),
5959
)
6060
.join("\n")
6161
);
@@ -69,7 +69,7 @@ export class FancyReporter extends BasicReporter {
6969

7070
if (isBadge) {
7171
return getBgColor(typeColor)(
72-
colors.black(` ${logObj.type.toUpperCase()} `)
72+
colors.black(` ${logObj.type.toUpperCase()} `),
7373
);
7474
}
7575

@@ -83,20 +83,20 @@ export class FancyReporter extends BasicReporter {
8383

8484
formatLogObj(logObj: LogObject, opts: FormatOptions) {
8585
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
86-
"\n"
86+
"\n",
8787
);
8888

8989
if (logObj.type === "box") {
9090
return box(
9191
characterFormat(
92-
message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
92+
message + (additional.length > 0 ? "\n" + additional.join("\n") : ""),
9393
),
9494
{
9595
title: logObj.title
9696
? characterFormat(logObj.title as string)
9797
: undefined,
9898
style: logObj.style as BoxOpts["style"],
99-
}
99+
},
100100
);
101101
}
102102

@@ -120,7 +120,7 @@ export class FancyReporter extends BasicReporter {
120120
: (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
121121

122122
line += characterFormat(
123-
additional.length > 0 ? "\n" + additional.join("\n") : ""
123+
additional.length > 0 ? "\n" + additional.join("\n") : "",
124124
);
125125

126126
if (logObj.type === "trace") {

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ export interface ConsolaReporter {
4949
logObj: LogObject,
5050
ctx: {
5151
options: ConsolaOptions;
52-
}
52+
},
5353
) => void;
5454
}

src/utils/box.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export function box(text: string, _opts: BoxOpts = {}) {
237237
if (_color) {
238238
for (const key in borderStyle) {
239239
borderStyle[key as keyof typeof borderStyle] = _color(
240-
borderStyle[key as keyof typeof borderStyle]
240+
borderStyle[key as keyof typeof borderStyle],
241241
);
242242
}
243243
}
@@ -260,22 +260,22 @@ export function box(text: string, _opts: BoxOpts = {}) {
260260
// Include the title if it exists with borders
261261
if (opts.title) {
262262
const left = borderStyle.h.repeat(
263-
Math.floor((width - stripAnsi(opts.title).length) / 2)
263+
Math.floor((width - stripAnsi(opts.title).length) / 2),
264264
);
265265
const right = borderStyle.h.repeat(
266266
width -
267267
stripAnsi(opts.title).length -
268268
stripAnsi(left).length +
269-
paddingOffset
269+
paddingOffset,
270270
);
271271
boxLines.push(
272-
`${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`
272+
`${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`,
273273
);
274274
} else {
275275
boxLines.push(
276276
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${
277277
borderStyle.tr
278-
}`
278+
}`,
279279
);
280280
}
281281

@@ -291,15 +291,17 @@ export function box(text: string, _opts: BoxOpts = {}) {
291291
if (i < valignOffset || i >= valignOffset + textLines.length) {
292292
// Empty line
293293
boxLines.push(
294-
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
294+
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${
295+
borderStyle.v
296+
}`,
295297
);
296298
} else {
297299
// Text line
298300
const line = textLines[i - valignOffset];
299301
const left = " ".repeat(paddingOffset);
300302
const right = " ".repeat(width - stripAnsi(line).length);
301303
boxLines.push(
302-
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
304+
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`,
303305
);
304306
}
305307
}
@@ -308,7 +310,7 @@ export function box(text: string, _opts: BoxOpts = {}) {
308310
boxLines.push(
309311
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${
310312
borderStyle.br
311-
}`
313+
}`,
312314
);
313315
if (opts.style.marginBottom > 0) {
314316
boxLines.push("".repeat(opts.style.marginBottom));

src/utils/color.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function replaceClose(
3232
replace: string,
3333
head = string.slice(0, Math.max(0, index)) + replace,
3434
tail = string.slice(Math.max(0, index + close.length)),
35-
next = tail.indexOf(close)
35+
next = tail.indexOf(close),
3636
): string {
3737
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
3838
}
@@ -42,7 +42,7 @@ function clearBleed(
4242
string: string,
4343
open: string,
4444
close: string,
45-
replace: string
45+
replace: string,
4646
) {
4747
return index < 0
4848
? open + string + close
@@ -53,7 +53,7 @@ function filterEmpty(
5353
open: string,
5454
close: string,
5555
replace = open,
56-
at = open.length + 1
56+
at = open.length + 1,
5757
) {
5858
return (string: string) =>
5959
string || !(string === "" || string === undefined)
@@ -62,7 +62,7 @@ function filterEmpty(
6262
string,
6363
open,
6464
close,
65-
replace
65+
replace,
6666
)
6767
: "";
6868
}
@@ -128,7 +128,7 @@ export const colors = createColors() as Record<ColorName, ColorFunction>;
128128

129129
export function getColor(
130130
color: ColorName,
131-
fallback: ColorName = "reset"
131+
fallback: ColorName = "reset",
132132
): ColorFunction {
133133
return colors[color] || colors[fallback];
134134
}

src/utils/format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function compileFormat(format: string) {
2020
for (const arg of FORMAT_ARGS) {
2121
_format = _format.replace(
2222
new RegExp("([%-])" + arg[0], "g"),
23-
"$1" + arg[1]
23+
"$1" + arg[1],
2424
);
2525
}
2626

0 commit comments

Comments
 (0)