Skip to content

Commit e13a4bb

Browse files
committed
chore: prettier
1 parent aaa2c48 commit e13a4bb

63 files changed

Lines changed: 553 additions & 383 deletions

File tree

Some content is hidden

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

eslint.config.mts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ export default defineConfig(
9494
},
9595
},
9696
{
97-
files: [
98-
"src/compiler/integrations/**/*.ts",
99-
"src/utils/utils.ts",
100-
],
97+
files: ["src/compiler/integrations/**/*.ts", "src/utils/utils.ts"],
10198
rules: {
10299
"@typescript-eslint/no-unsafe-assignment": "off",
103100
"@typescript-eslint/no-unsafe-call": "off",

src/cache/DataStore.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ export class DataStore {
167167
timestamp?: number,
168168
): Promise<void> {
169169
const existing = await this.getCacheEntry(path);
170-
const sourceMtime =
171-
updates.sourceMtime ?? existing?.sourceMtime ?? 0;
170+
const sourceMtime = updates.sourceMtime ?? existing?.sourceMtime ?? 0;
172171

173172
await this.setCacheEntry(path, {
174173
version: this.version,
@@ -328,10 +327,7 @@ export class DataStore {
328327
return null;
329328
}
330329

331-
if (
332-
currentMtime !== undefined &&
333-
data.sourceMtime !== currentMtime
334-
) {
330+
if (currentMtime !== undefined && data.sourceMtime !== currentMtime) {
335331
return null;
336332
}
337333

@@ -424,10 +420,7 @@ export class DataStore {
424420
if (!data?.localHash) {
425421
return null;
426422
}
427-
if (
428-
currentMtime !== undefined &&
429-
data.sourceMtime !== currentMtime
430-
) {
423+
if (currentMtime !== undefined && data.sourceMtime !== currentMtime) {
431424
return null;
432425
}
433426
return data.localHash;

src/cli/handlers/cliUtils.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class GitBackendRepositoryAdapter {
2525
if (!match) return undefined;
2626

2727
const blob = await this.backend.readBlob(match.sha);
28-
// eslint-disable-next-line no-undef -- Buffer is available in Node.js and Electron environments
28+
// eslint-disable-next-line no-undef -- Buffer is available in Node.js and Electron environments
2929
const content = Buffer.from(blob).toString("base64");
3030

3131
return {
@@ -103,10 +103,7 @@ export function createRepositoryAdapter(
103103
);
104104
const branch = plugin.settings.gitBranch || "v4";
105105

106-
return new GitBackendRepositoryAdapter(
107-
backend,
108-
branch,
109-
) as unknown as RepositoryConnection;
106+
return new GitBackendRepositoryAdapter(backend, branch);
110107
}
111108

112109
export function getValueByPath(
@@ -159,7 +156,11 @@ export function setValueByPath(
159156
}
160157

161158
const existing = current[part];
162-
if (!existing || typeof existing !== "object" || Array.isArray(existing)) {
159+
if (
160+
!existing ||
161+
typeof existing !== "object" ||
162+
Array.isArray(existing)
163+
) {
163164
const next: Record<string, unknown> = {};
164165
current[part] = next;
165166
current = next;
@@ -176,8 +177,7 @@ export function parseCliValue(rawValue: string | undefined): unknown {
176177

177178
if (trimmed === "") return "";
178179

179-
const looksLikeJson =
180-
trimmed.startsWith("{") || trimmed.startsWith("[");
180+
const looksLikeJson = trimmed.startsWith("{") || trimmed.startsWith("[");
181181
const isPrimitive =
182182
trimmed === "true" ||
183183
trimmed === "false" ||

src/cli/handlers/markHandler.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export function createMarkHandler(_plugin: QuartzSyncer): CliHandler {
2323
);
2424
const key = _plugin.settings.publishFrontmatterKey;
2525
const currentValue = Boolean(engine.get(key));
26-
const rawState = params.args.state ??
26+
const rawState =
27+
params.args.state ??
2728
(params.flags.has("toggle") ? "toggle" : undefined);
2829
const state = rawState?.toLowerCase();
2930

@@ -36,9 +37,7 @@ export function createMarkHandler(_plugin: QuartzSyncer): CliHandler {
3637
) {
3738
nextValue = true;
3839
engine.set(key, true);
39-
} else if (
40-
["false", "off", "no", "0"].includes(state)
41-
) {
40+
} else if (["false", "off", "no", "0"].includes(state)) {
4241
nextValue = false;
4342
engine.set(key, false);
4443
} else if (["unset", "remove", "clear"].includes(state)) {
@@ -54,8 +53,7 @@ export function createMarkHandler(_plugin: QuartzSyncer): CliHandler {
5453
success: true,
5554
data: {
5655
path,
57-
publish:
58-
nextValue === null ? "removed" : nextValue,
56+
publish: nextValue === null ? "removed" : nextValue,
5957
},
6058
};
6159
};

src/cli/handlers/pluginHandler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type QuartzSyncer from "src/main";
22
import type { CliHandler } from "src/cli/types";
3-
import { createRepositoryAdapter, parseCliValue } from "src/cli/handlers/cliUtils";
3+
import {
4+
createRepositoryAdapter,
5+
parseCliValue,
6+
} from "src/cli/handlers/cliUtils";
47
import { QuartzConfigService } from "src/quartz/QuartzConfigService";
58
import { QuartzPluginManager } from "src/quartz/QuartzPluginManager";
69
import type { QuartzPluginSource } from "src/quartz/QuartzConfigTypes";

src/cli/handlers/quartzConfigHandler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ export function createQuartzConfigHandler(plugin: QuartzSyncer): CliHandler {
3333
}
3434
const value = getValueByPath(configRecord, key);
3535
if (value === undefined) {
36-
return { success: false, error: `Config key not found: ${key}` };
36+
return {
37+
success: false,
38+
error: `Config key not found: ${key}`,
39+
};
3740
}
3841
return { success: true, data: { key, value } };
3942
}

src/cli/handlers/versionHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ export function createVersionHandler(plugin: QuartzSyncer): CliHandler {
4242
},
4343
};
4444
} catch (error) {
45-
const message = error instanceof Error ? error.message : String(error);
45+
const message =
46+
error instanceof Error ? error.message : String(error);
4647
return { success: false, error: message };
4748
}
4849
};

src/cli/registerCliHandlers.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ export function registerCliHandlers(plugin: QuartzSyncer): void {
8181

8282
plugin.addCommand({
8383
id: command.replace(/[:/]/g, "-"),
84-
name: COMMAND_LABELS[command as (typeof COMMANDS)[number]] ??
84+
name:
85+
COMMAND_LABELS[command as (typeof COMMANDS)[number]] ??
8586
`Quartz Syncer: ${command}`,
8687
callback: () => {
8788
void handleCommand(command, {});
@@ -123,7 +124,10 @@ function normalizeCliParams(
123124
const trimmedKey = key.trim();
124125
const trimmedValue = value?.trim();
125126

126-
if (trimmedKey.includes("=") && (!trimmedValue || trimmedValue === "true")) {
127+
if (
128+
trimmedKey.includes("=") &&
129+
(!trimmedValue || trimmedValue === "true")
130+
) {
127131
const [parsedKey, parsedValue] = trimmedKey.split("=", 2);
128132
if (parsedKey && parsedValue) {
129133
args[parsedKey] = parsedValue;

src/compiler/integrations/AssetSyncer.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { integrationRegistry } from "./registry";
33
import QuartzSyncerSettings from "src/models/settings";
44

55
export interface RepositoryConnection {
6-
getContent(): Promise<{ tree: Array<{ path: string; type: "blob" | "tree" }> } | null>;
6+
getContent(): Promise<{
7+
tree: Array<{ path: string; type: "blob" | "tree" }>;
8+
} | null>;
79
getRawFile(path: string): Promise<{ content: string } | null>;
810
}
911

@@ -150,7 +152,8 @@ export class AssetSyncer {
150152
let content = "";
151153

152154
try {
153-
const customScss = await connection.getRawFile(CUSTOM_SCSS_PATH);
155+
const customScss =
156+
await connection.getRawFile(CUSTOM_SCSS_PATH);
154157

155158
if (customScss) {
156159
/* eslint-disable-next-line no-undef -- Buffer polyfill available at runtime */

src/compiler/integrations/apis/dataview.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ interface DataviewApi {
2525
}
2626

2727
function getDataviewApi(): DataviewApi | undefined {
28-
const globalApp = (window as {
29-
app?: { plugins?: { plugins?: Record<string, { api?: DataviewApi }> } };
30-
}).app;
28+
const globalApp = (
29+
window as {
30+
app?: {
31+
plugins?: { plugins?: Record<string, { api?: DataviewApi }> };
32+
};
33+
}
34+
).app;
3135
const plugin = globalApp?.plugins?.plugins?.[DATAVIEW_PLUGIN_ID];
3236

3337
return plugin?.api;

0 commit comments

Comments
 (0)