Skip to content

Commit b7ed27b

Browse files
cvclaude
andcommitted
fix(lint): resolve ESLint errors and format issues
- Remove async from functions without await in fetch.ts, use Promise.reject/resolve instead - Add braces to void arrow expression in logs.ts - Configure allowDefaultProject for test files excluded from tsconfig - Relax no-unsafe-assignment/member-access rules for test files - Fix unused variable in status.test.ts - Apply prettier formatting to all source files Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 0db938a commit b7ed27b

10 files changed

Lines changed: 89 additions & 43 deletions

File tree

‎nemoclaw/eslint.config.mjs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export default [
88
languageOptions: {
99
parser: tsparser,
1010
parserOptions: {
11-
projectService: true,
11+
projectService: {
12+
allowDefaultProject: ["src/*/*.test.ts"],
13+
},
1214
tsconfigRootDir: import.meta.dirname,
1315
},
1416
},
@@ -27,5 +29,12 @@ export default [
2729
"@typescript-eslint/consistent-type-imports": "error",
2830
},
2931
},
32+
{
33+
files: ["src/**/*.test.ts"],
34+
rules: {
35+
"@typescript-eslint/no-unsafe-assignment": "off",
36+
"@typescript-eslint/no-unsafe-member-access": "off",
37+
},
38+
},
3039
prettier,
3140
];

‎nemoclaw/src/blueprint/fetch.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ export function fetchBlueprint(registry: string, version: string): Promise<Resol
3636
* Resolve a "latest" version tag to a concrete version string by querying
3737
* the registry's tag list or release API.
3838
*/
39-
export async function resolveLatestVersion(registry: string): Promise<string> {
39+
export function resolveLatestVersion(registry: string): Promise<string> {
4040
// Future: query OCI tag list or GitHub releases API
4141
void registry;
42-
throw new Error("Latest version resolution not yet implemented.");
42+
return Promise.reject(new Error("Latest version resolution not yet implemented."));
4343
}
4444

4545
/**
4646
* Download and extract a blueprint tarball into the local cache directory.
4747
* Returns the local path where the blueprint was extracted.
4848
*/
49-
export async function downloadAndCache(
49+
export function downloadAndCache(
5050
registry: string,
5151
version: string,
5252
): Promise<{ localPath: string; manifest: BlueprintManifest }> {
@@ -57,5 +57,5 @@ export async function downloadAndCache(
5757
if (!manifest) {
5858
throw new Error(`Failed to read manifest after download for version ${version}`);
5959
}
60-
return { localPath, manifest };
60+
return Promise.resolve({ localPath, manifest });
6161
}

‎nemoclaw/src/cli.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ export function registerCliCommands(ctx: PluginCliContext, api: OpenClawPluginAp
110110
.command("onboard")
111111
.description("Interactive setup: configure inference endpoint, credential, and model")
112112
.option("--api-key <key>", "API key for endpoints that require one (skips prompt)")
113-
.option("--endpoint <type>", "Endpoint type: build, ncp, ollama, nim-local, vllm, custom (nim-local and vllm are experimental)")
113+
.option(
114+
"--endpoint <type>",
115+
"Endpoint type: build, ncp, ollama, nim-local, vllm, custom (nim-local and vllm are experimental)",
116+
)
114117
.option("--ncp-partner <name>", "NCP partner name (when endpoint is ncp)")
115118
.option("--endpoint-url <url>", "Endpoint URL (for ncp, nim-local, ollama, or custom)")
116119
.option("--model <model>", "Model ID to use")

‎nemoclaw/src/commands/logs.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ export async function cliLogs(opts: LogsOptions): Promise<void> {
5151
const proc = spawn("openshell", args, { stdio: ["ignore", "inherit", "inherit"] });
5252

5353
await new Promise<void>((resolve) => {
54-
proc.on("close", () => resolve());
54+
proc.on("close", () => {
55+
resolve();
56+
});
5557
proc.on("error", (err) => {
5658
logger.error(`Failed to stream logs: ${err.message}`);
5759
resolve();

‎nemoclaw/src/commands/migrate.ts‎

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,10 @@ export async function cliMigrate(opts: MigrateOptions): Promise<void> {
183183
async function buildMigrationArchives(bundle: SnapshotBundle): Promise<void> {
184184
await createArchiveFromDirectory(bundle.preparedStateDir, stateArchivePath(bundle));
185185
for (const root of bundle.manifest.externalRoots) {
186-
await createArchiveFromDirectory(join(bundle.snapshotDir, root.snapshotRelativePath), rootArchivePath(bundle, root.id));
186+
await createArchiveFromDirectory(
187+
join(bundle.snapshotDir, root.snapshotRelativePath),
188+
rootArchivePath(bundle, root.id),
189+
);
187190
}
188191
}
189192

@@ -192,21 +195,25 @@ function syncSnapshotBundleIntoSandbox(bundle: SnapshotBundle, sandboxName: stri
192195

193196
syncArchive(sandboxName, "state.tar", stateArchivePath(bundle), "/sandbox/.openclaw");
194197
for (const root of bundle.manifest.externalRoots) {
195-
syncArchive(
196-
sandboxName,
197-
`${root.id}.tar`,
198-
rootArchivePath(bundle, root.id),
199-
root.sandboxPath,
200-
);
198+
syncArchive(sandboxName, `${root.id}.tar`, rootArchivePath(bundle, root.id), root.sandboxPath);
201199
}
202200
}
203201

204-
function syncArchive(sandboxName: string, archiveName: string, archivePath: string, destinationDir: string): void {
202+
function syncArchive(
203+
sandboxName: string,
204+
archiveName: string,
205+
archivePath: string,
206+
destinationDir: string,
207+
): void {
205208
const sandboxArchivePath = pathPosix.join(SANDBOX_ARCHIVE_DIR, archiveName);
206-
execFileSync("openshell", ["sandbox", "cp", archivePath, `${sandboxName}:${sandboxArchivePath}`], {
207-
encoding: "utf-8",
208-
stdio: ["ignore", "pipe", "pipe"],
209-
});
209+
execFileSync(
210+
"openshell",
211+
["sandbox", "cp", archivePath, `${sandboxName}:${sandboxArchivePath}`],
212+
{
213+
encoding: "utf-8",
214+
stdio: ["ignore", "pipe", "pipe"],
215+
},
216+
);
210217

211218
const extractCommand = [
212219
"sh",

‎nemoclaw/src/commands/migration-state.ts‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ function collectSymlinkPaths(rootPath: string): string[] {
176176
}
177177

178178
function slugify(input: string): string {
179-
const slug = input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
179+
const slug = input
180+
.toLowerCase()
181+
.replace(/[^a-z0-9]+/g, "-")
182+
.replace(/^-+|-+$/g, "");
180183
return slug || "root";
181184
}
182185

@@ -416,8 +419,11 @@ export function detectHostOpenClaw(env: NodeJS.ProcessEnv = process.env): HostOp
416419
typeof config["agents"] === "object" &&
417420
config["agents"] &&
418421
!Array.isArray(config["agents"]) &&
419-
typeof ((config["agents"] as Record<string, unknown>)["defaults"] as Record<string, unknown> | undefined)
420-
?.["workspace"] === "string"
422+
typeof (
423+
(config["agents"] as Record<string, unknown>)["defaults"] as
424+
| Record<string, unknown>
425+
| undefined
426+
)?.["workspace"] === "string"
421427
? resolveUserPath(
422428
(
423429
((config["agents"] as Record<string, unknown>)["defaults"] as Record<string, unknown>)[
@@ -431,7 +437,9 @@ export function detectHostOpenClaw(env: NodeJS.ProcessEnv = process.env): HostOp
431437
const extensionsDir = existsSync(path.join(stateDir, "extensions"))
432438
? path.join(stateDir, "extensions")
433439
: null;
434-
const skillsDir = existsSync(path.join(stateDir, "skills")) ? path.join(stateDir, "skills") : null;
440+
const skillsDir = existsSync(path.join(stateDir, "skills"))
441+
? path.join(stateDir, "skills")
442+
: null;
435443
const hooksDir = existsSync(path.join(stateDir, "hooks")) ? path.join(stateDir, "hooks") : null;
436444

437445
if (existsSync(workspaceDir)) {
@@ -476,7 +484,9 @@ function writeSnapshotManifest(snapshotDir: string, manifest: SnapshotManifest):
476484
}
477485

478486
function readSnapshotManifest(snapshotDir: string): SnapshotManifest {
479-
return JSON.parse(readFileSync(path.join(snapshotDir, "snapshot.json"), "utf-8")) as SnapshotManifest;
487+
return JSON.parse(
488+
readFileSync(path.join(snapshotDir, "snapshot.json"), "utf-8"),
489+
) as SnapshotManifest;
480490
}
481491

482492
function resolveConfigSourcePath(manifest: SnapshotManifest, snapshotDir: string): string {
@@ -486,7 +496,11 @@ function resolveConfigSourcePath(manifest: SnapshotManifest, snapshotDir: string
486496
return path.join(snapshotDir, "openclaw", "openclaw.json");
487497
}
488498

489-
function setConfigValue(document: Record<string, unknown>, configPath: string, value: string): void {
499+
function setConfigValue(
500+
document: Record<string, unknown>,
501+
configPath: string,
502+
value: string,
503+
): void {
490504
const tokens = configPath.match(/[^.[\]]+/g);
491505
if (!tokens || tokens.length === 0) {
492506
throw new Error(`Invalid config path: ${configPath}`);
@@ -537,7 +551,7 @@ function prepareSandboxState(snapshotDir: string, manifest: SnapshotManifest): s
537551
copyDirectory(path.join(snapshotDir, "openclaw"), preparedStateDir);
538552

539553
const configSourcePath = resolveConfigSourcePath(manifest, snapshotDir);
540-
const config = existsSync(configSourcePath) ? loadConfigDocument(configSourcePath) ?? {} : {};
554+
const config = existsSync(configSourcePath) ? (loadConfigDocument(configSourcePath) ?? {}) : {};
541555

542556
for (const root of manifest.externalRoots) {
543557
for (const binding of root.bindings) {

‎nemoclaw/src/commands/onboard.ts‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,10 @@ function showConfig(config: NemoClawOnboardConfig, logger: PluginLogger): void {
172172
logger.info(` Onboarded: ${config.onboardedAt}`);
173173
}
174174

175-
async function promptEndpoint(
176-
ollama: { installed: boolean; running: boolean },
177-
): Promise<EndpointType> {
175+
async function promptEndpoint(ollama: {
176+
installed: boolean;
177+
running: boolean;
178+
}): Promise<EndpointType> {
178179
const options = [
179180
{
180181
label: "NVIDIA Build (build.nvidia.com)",
@@ -258,9 +259,7 @@ export async function cliOnboard(opts: OnboardOptions): Promise<void> {
258259
}
259260
const ep = opts.endpoint as EndpointType;
260261
if (!SUPPORTED_ENDPOINT_TYPES.includes(ep)) {
261-
logger.warn(
262-
`Note: '${ep}' is experimental and may not work reliably.`,
263-
);
262+
logger.warn(`Note: '${ep}' is experimental and may not work reliably.`);
264263
}
265264
endpointType = ep;
266265
} else {
@@ -373,10 +372,12 @@ export async function cliOnboard(opts: OnboardOptions): Promise<void> {
373372
: validation.models.map((id) => ({ label: id, value: id }));
374373
const curatedCloudOptions =
375374
endpointType === "build" || endpointType === "ncp"
376-
? DEFAULT_MODELS.filter((option) => validation.models.includes(option.id)).map((option) => ({
377-
label: `${option.label} (${option.id})`,
378-
value: option.id,
379-
}))
375+
? DEFAULT_MODELS.filter((option) => validation.models.includes(option.id)).map(
376+
(option) => ({
377+
label: `${option.label} (${option.id})`,
378+
value: option.id,
379+
}),
380+
)
380381
: [];
381382
const defaultIndex =
382383
endpointType === "ollama"

‎nemoclaw/src/commands/status.test.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,7 @@ describe("cliStatus", () => {
352352
expect(data.nemoclaw.lastAction).toBe("migrate");
353353
expect(data.nemoclaw.blueprintVersion).toBe("0.1.0");
354354
expect(data.nemoclaw.lastRunId).toBe("run-a1b2c3d4");
355-
expect(data.nemoclaw.migrationSnapshot).toBe(
356-
"/root/.nemoclaw/snapshots/pre-migrate.tar.gz",
357-
);
355+
expect(data.nemoclaw.migrationSnapshot).toBe("/root/.nemoclaw/snapshots/pre-migrate.tar.gz");
358356
});
359357
});
360358

@@ -392,7 +390,7 @@ describe("cliStatus", () => {
392390
"inference get": new Error("not configured"),
393391
});
394392

395-
const { lines, logger } = captureLogger();
393+
const { logger } = captureLogger();
396394
await cliStatus({ json: true, logger, pluginConfig: defaultConfig });
397395

398396
// Verify exec was called with default name

‎nemoclaw/src/commands/status.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ interface SandboxStatusResponse {
123123
uptime?: string;
124124
}
125125

126-
async function getSandboxStatus(sandboxName: string, insideSandbox: boolean): Promise<SandboxStatus> {
126+
async function getSandboxStatus(
127+
sandboxName: string,
128+
insideSandbox: boolean,
129+
): Promise<SandboxStatus> {
127130
if (insideSandbox) {
128131
return { name: sandboxName, running: false, uptime: null, insideSandbox: true };
129132
}

‎nemoclaw/src/index.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ export interface NemoClawConfig {
147147
inferenceProvider: string;
148148
}
149149

150-
function activeModelEntries(onboardCfg: ReturnType<typeof loadOnboardConfig>): ModelProviderEntry[] {
150+
function activeModelEntries(
151+
onboardCfg: ReturnType<typeof loadOnboardConfig>,
152+
): ModelProviderEntry[] {
151153
if (!onboardCfg?.model) {
152154
return [
153155
{
@@ -202,7 +204,14 @@ function registeredProviderForConfig(
202204
aliases: ["inference-local", "nemoclaw"],
203205
envVars: [providerCredentialEnv],
204206
models: { chat: activeModelEntries(onboardCfg) },
205-
auth: [{ type: "bearer", envVar: providerCredentialEnv, headerName: "Authorization", label: authLabel }],
207+
auth: [
208+
{
209+
type: "bearer",
210+
envVar: providerCredentialEnv,
211+
headerName: "Authorization",
212+
label: authLabel,
213+
},
214+
],
206215
};
207216
}
208217

0 commit comments

Comments
 (0)