chore(lint): enable stricter oxlint rules

This commit is contained in:
Peter Steinberger
2026-05-31 18:43:54 +01:00
parent cb569f6ad9
commit 304e2c83c0
615 changed files with 3603 additions and 3701 deletions

View File

@@ -96,7 +96,7 @@ function packageBackedDockerRunnerPaths(): string[] {
.filter((entry) => entry.endsWith("-docker.sh"))
.map((entry) => join("scripts/e2e", entry))
.filter((path) => readFileSync(path, "utf8").includes("docker_e2e_prepare_package_tgz"))
.sort();
.toSorted();
}
function shellQuote(value: string): string {

View File

@@ -364,7 +364,7 @@ setInterval(() => {}, 1000);
expect(samples[0]).toMatchObject({
aggregateRssMiB: 640,
label: "plugins install",
processId: seenPids[0]! + 1,
processId: seenPids[0] + 1,
rssMiB: 512,
});
expect(samples[0]?.elapsedMs).toBeGreaterThanOrEqual(0);

View File

@@ -152,7 +152,7 @@ describe("scripts/mantis/publish-pr-evidence", () => {
"content-type": "image/png",
"x-amz-date": expect.any(String),
});
expect((requests[0]?.headers as Record<string, string>).authorization).toContain(
expect((requests[0].headers as Record<string, string>).authorization).toContain(
"Credential=access/",
);
expect(String(requests[4]?.body)).toContain(

View File

@@ -1,5 +1,5 @@
import { spawnSync } from "node:child_process";
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";

View File

@@ -175,14 +175,6 @@ describe("oxlint config", () => {
],
rules: {
"typescript/no-explicit-any": "off",
"typescript/unbound-method": "off",
"eslint/no-unsafe-optional-chaining": "off",
},
},
{
files: ["src/agents/embedded-agent-runner/run/attempt.ts"],
rules: {
"eslint/no-shadow": "error",
},
},
]);

View File

@@ -124,7 +124,8 @@ describe("package acceptance workflow", () => {
const crabboxConfig = parse(readFileSync(CRABBOX_CONFIG, "utf8")) as {
actions?: { job?: string };
};
const workflow = readWorkflow(CRABBOX_HYDRATE_WORKFLOW);
const ignoredWorkflow = readWorkflow(CRABBOX_HYDRATE_WORKFLOW);
void ignoredWorkflow;
const workflowText = readFileSync(CRABBOX_HYDRATE_WORKFLOW, "utf8");
const hydrate = workflowJob(CRABBOX_HYDRATE_WORKFLOW, "hydrate");
const hydrateWindowsDaemon = workflowJob(CRABBOX_HYDRATE_WORKFLOW, "hydrate-windows-daemon");

View File

@@ -84,7 +84,7 @@ function writeFakePrlctl(tempDir: string, posixScript: string, windowsBootstrap:
function withEnv<T>(env: Record<string, string>, callback: () => T): T {
const previous = new Map<string, string | undefined>();
for (const [key, value] of Object.entries(env)) {
for (const [key, _value] of Object.entries(env)) {
previous.set(key, process.env[key]);
}
for (const [key, value] of Object.entries(env)) {

View File

@@ -19,14 +19,6 @@ import { writePackageDistInventory } from "../../src/infra/package-dist-inventor
import { createScriptTestHarness } from "./test-helpers.js";
const { createTempDirAsync } = createScriptTestHarness();
async function createExtensionsDir() {
const root = await createTempDirAsync("openclaw-postinstall-");
const extensionsDir = path.join(root, "dist", "extensions");
await fs.mkdir(extensionsDir, { recursive: true });
return extensionsDir;
}
async function expectPathExists(filePath: string) {
await expect(fs.access(filePath)).resolves.toBeUndefined();
}

View File

@@ -1,9 +1,8 @@
import { spawn, spawnSync, type ChildProcessWithoutNullStreams } from "node:child_process";
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { spawnSync } from "node:child_process";
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { createServer, type AddressInfo, type Socket } from "node:net";
import { tmpdir } from "node:os";
import path from "node:path";
import { setTimeout as delay } from "node:timers/promises";
import { describe, expect, it } from "vitest";
import { runReleaseUserJourneyAssertion } from "../../scripts/e2e/lib/release-user-journey/assertions.mjs";
@@ -50,55 +49,6 @@ async function withEnv<T>(env: Record<string, string>, callback: () => Promise<T
}
}
async function waitForFile(filePath: string, timeoutMs = 3000): Promise<string> {
const startedAt = Date.now();
while (Date.now() - startedAt < timeoutMs) {
if (existsSync(filePath)) {
return readFileSync(filePath, "utf8");
}
await delay(25);
}
throw new Error(`timed out waiting for ${filePath}`);
}
async function stopChild(child: ChildProcessWithoutNullStreams): Promise<void> {
if (child.exitCode !== null) {
return;
}
child.kill("SIGTERM");
const startedAt = Date.now();
while (child.exitCode === null && Date.now() - startedAt < 1000) {
await delay(25);
}
if (child.exitCode === null) {
child.kill("SIGKILL");
}
}
function startTcpFixture(portPath: string, connectionHandlerSource: string) {
return spawn(
process.execPath,
[
"--input-type=module",
"--eval",
[
'import net from "node:net";',
'import fs from "node:fs";',
`const server = net.createServer(${connectionHandlerSource});`,
'server.listen(0, "127.0.0.1", () => {',
" const address = server.address();",
" fs.writeFileSync(process.env.PORT_FILE, String(address.port));",
"});",
"setInterval(() => {}, 1000);",
].join("\n"),
],
{
env: { ...process.env, PORT_FILE: portPath },
stdio: "pipe",
},
);
}
async function startTcpFixtureServer(handler: (socket: Socket) => void): Promise<{
port: number;
stop: () => Promise<void>;

View File

@@ -1,4 +1,4 @@
import { execFileSync, spawnSync } from "node:child_process";
import { spawnSync } from "node:child_process";
import path from "node:path";
import { bundledPluginFile, bundledPluginRoot } from "openclaw/plugin-sdk/test-fixtures";
import { beforeAll, describe, expect, it, vi } from "vitest";
@@ -30,14 +30,6 @@ type RunGroupParams = {
env: Record<string, string | undefined>;
targets: string[];
};
function runScript(args: string[], cwd = process.cwd()) {
return execFileSync(process.execPath, [scriptPath, ...args], {
cwd,
encoding: "utf8",
});
}
function runScriptResult(args: string[], cwd = process.cwd()) {
return spawnSync(process.execPath, [scriptPath, ...args], {
cwd,
@@ -475,7 +467,9 @@ describe("scripts/test-extension.mjs", () => {
extensionIds: [extensionId, "firecrawl"],
});
expect(batch.extensionIds).toEqual([extensionId, "firecrawl"].toSorted());
expect(batch.extensionIds).toEqual(
[extensionId, "firecrawl"].toSorted((left, right) => left.localeCompare(right)),
);
expect(batch.extensionCount).toBe(2);
expect(batch.noTestExtensionIds).toEqual([extensionId]);
expect(batch.hasTests).toBe(true);

View File

@@ -1,5 +1,5 @@
import { spawnSync } from "node:child_process";
import fs, { readFileSync } from "node:fs";
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
import {
LIVE_TEST_SHARDS,