Skip to content

Commit 1a0ab58

Browse files
committed
chore: lint fixes
1 parent 4256ff1 commit 1a0ab58

4 files changed

Lines changed: 6 additions & 32 deletions

File tree

scripts/benchmarks/run.mjs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,6 @@ const runCli = async (args) => {
106106
});
107107
};
108108

109-
const runGit = async (args, cwd) => {
110-
await execFileAsync("git", args, {
111-
cwd,
112-
maxBuffer: 1024 * 1024,
113-
});
114-
};
115-
116109
const formatRow = (result) => {
117110
const min = result.min ?? 0;
118111
const max = result.max ?? 0;

src/init.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ import {
88
} from "@clack/prompts";
99
import {
1010
DEFAULT_CACHE_DIR,
11-
DEFAULT_CONFIG,
1211
DEFAULT_CONFIG_FILENAME,
1312
type DocsCacheConfig,
14-
resolveConfigPath,
1513
writeConfig,
1614
} from "./config";
1715

@@ -46,16 +44,6 @@ export const initConfig = async (
4644
const select = deps.select ?? clackSelect;
4745
const text = deps.text ?? clackText;
4846
const cwd = options.cwd ?? process.cwd();
49-
const defaults = {
50-
ref: DEFAULT_CONFIG.defaults?.ref ?? "HEAD",
51-
targetMode:
52-
DEFAULT_CONFIG.defaults?.targetMode ??
53-
(process.platform === "win32" ? "copy" : "symlink"),
54-
allowHosts: DEFAULT_CONFIG.defaults?.allowHosts ?? [
55-
"github.com",
56-
"gitlab.com",
57-
],
58-
};
5947
const defaultConfigPath = path.resolve(cwd, DEFAULT_CONFIG_FILENAME);
6048
const packagePath = path.resolve(cwd, "package.json");
6149
const existingConfigPaths: string[] = [];

src/remove.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { access, readFile, rm, writeFile } from "node:fs/promises";
22
import path from "node:path";
33
import {
44
DEFAULT_CONFIG,
5-
DEFAULT_CONFIG_FILENAME,
65
type DocsCacheConfig,
76
resolveConfigPath,
87
validateConfig,
@@ -102,7 +101,10 @@ export const removeSources = async (params: {
102101
}
103102
const resolved = resolveRepoInput(token);
104103
if (resolved.repoUrl && sourcesByRepo.has(resolved.repoUrl)) {
105-
idsToRemove.add(sourcesByRepo.get(resolved.repoUrl)!.id);
104+
const entry = sourcesByRepo.get(resolved.repoUrl);
105+
if (entry) {
106+
idsToRemove.add(entry.id);
107+
}
106108
continue;
107109
}
108110
if (resolved.inferredId && sourcesById.has(resolved.inferredId)) {

tests/edge-cases.test.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,7 @@ import { tmpdir } from "node:os";
44
import path from "node:path";
55
import { test } from "node:test";
66

7-
import { loadConfig, runSync } from "../dist/api.mjs";
8-
9-
const exists = async (target) => {
10-
try {
11-
await import("node:fs/promises").then(({ access }) => access(target));
12-
return true;
13-
} catch {
14-
return false;
15-
}
16-
};
7+
import { loadConfig } from "../dist/api.mjs";
178

189
const writeConfig = async (data) => {
1910
const tmpRoot = path.join(
@@ -216,7 +207,7 @@ test("config rejects BOM (Byte Order Mark)", async () => {
216207
// UTF-8 BOM - this is a real edge case that can happen with Windows editors
217208
await writeFile(
218209
configPath,
219-
"\uFEFF" + JSON.stringify(config, null, 2),
210+
`\uFEFF${JSON.stringify(config, null, 2)}`,
220211
"utf8",
221212
);
222213

0 commit comments

Comments
 (0)