Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
210 lines
6.4 KiB
TypeScript
210 lines
6.4 KiB
TypeScript
// Oxlint Config tests cover oxlint config script behavior.
|
|
import fs from "node:fs";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
type OxlintConfig = {
|
|
ignorePatterns?: string[];
|
|
overrides?: Array<{ files?: string[]; rules?: Record<string, unknown> }>;
|
|
rules?: Record<string, unknown>;
|
|
};
|
|
|
|
type OxlintTsconfig = {
|
|
include?: string[];
|
|
exclude?: string[];
|
|
};
|
|
|
|
const ZERO_BASELINE_RULES = [
|
|
"eslint/no-div-regex",
|
|
"eslint/no-constructor-return",
|
|
"eslint/no-extra-label",
|
|
"eslint/no-lone-blocks",
|
|
"eslint/no-multi-str",
|
|
"eslint/no-proto",
|
|
"eslint/no-regex-spaces",
|
|
"eslint/no-sequences",
|
|
"eslint/no-self-compare",
|
|
"eslint/no-var",
|
|
"eslint/no-param-reassign",
|
|
"eslint/no-implicit-coercion",
|
|
"eslint/no-useless-rename",
|
|
"eslint/no-useless-return",
|
|
"eslint/no-new-wrappers",
|
|
"eslint/no-else-return",
|
|
"eslint/no-lonely-if",
|
|
"eslint/no-case-declarations",
|
|
"eslint/object-shorthand",
|
|
"eslint/prefer-exponentiation-operator",
|
|
"eslint/prefer-const",
|
|
"eslint/prefer-numeric-literals",
|
|
"eslint/prefer-object-has-own",
|
|
"eslint/radix",
|
|
"eslint/unicode-bom",
|
|
"eslint/yoda",
|
|
"import/no-absolute-path",
|
|
"import/first",
|
|
"import/no-empty-named-blocks",
|
|
"import/no-duplicates",
|
|
"import/no-self-import",
|
|
"node/no-exports-assign",
|
|
"promise/no-new-statics",
|
|
"typescript/adjacent-overload-signatures",
|
|
"typescript/ban-tslint-comment",
|
|
"typescript/no-import-type-side-effects",
|
|
"typescript/no-inferrable-types",
|
|
"typescript/no-non-null-asserted-nullish-coalescing",
|
|
"typescript/no-unnecessary-qualifier",
|
|
"typescript/prefer-find",
|
|
"typescript/prefer-for-of",
|
|
"typescript/prefer-function-type",
|
|
"typescript/prefer-includes",
|
|
"typescript/prefer-reduce-type-parameter",
|
|
"typescript/prefer-return-this-type",
|
|
"unicorn/consistent-date-clone",
|
|
"unicorn/consistent-empty-array-spread",
|
|
"unicorn/no-console-spaces",
|
|
"unicorn/no-length-as-slice-end",
|
|
"unicorn/no-instanceof-array",
|
|
"unicorn/no-negation-in-equality-check",
|
|
"unicorn/no-new-buffer",
|
|
"unicorn/no-typeof-undefined",
|
|
"unicorn/no-unreadable-array-destructuring",
|
|
"unicorn/no-useless-error-capture-stack-trace",
|
|
"unicorn/no-zero-fractions",
|
|
"unicorn/prefer-array-flat",
|
|
"unicorn/prefer-array-some",
|
|
"unicorn/prefer-dom-node-text-content",
|
|
"unicorn/prefer-keyboard-event-key",
|
|
"unicorn/prefer-math-min-max",
|
|
"unicorn/prefer-negative-index",
|
|
"unicorn/prefer-node-protocol",
|
|
"unicorn/prefer-number-properties",
|
|
"unicorn/prefer-optional-catch-binding",
|
|
"unicorn/prefer-prototype-methods",
|
|
"unicorn/prefer-regexp-test",
|
|
"unicorn/prefer-set-has",
|
|
"unicorn/prefer-structured-clone",
|
|
"unicorn/prefer-string-slice",
|
|
"unicorn/require-array-join-separator",
|
|
"unicorn/require-number-to-fixed-digits-argument",
|
|
"unicorn/throw-new-error",
|
|
"vitest/no-import-node-test",
|
|
"vitest/consistent-vitest-vi",
|
|
"vitest/prefer-called-once",
|
|
"vitest/prefer-called-times",
|
|
"vitest/prefer-expect-type-of",
|
|
];
|
|
|
|
function readJson(path: string): unknown {
|
|
return JSON.parse(fs.readFileSync(path, "utf8")) as unknown;
|
|
}
|
|
|
|
describe("oxlint config", () => {
|
|
it("includes bundled extensions in type-aware lint coverage", () => {
|
|
const tsconfig = readJson("config/tsconfig/oxlint.json") as OxlintTsconfig;
|
|
|
|
expect(tsconfig.include).toContain("../../extensions/**/*");
|
|
expect(tsconfig.exclude ?? []).not.toContain("../../extensions");
|
|
});
|
|
|
|
it("includes scripts in root type-aware lint coverage", () => {
|
|
const tsconfig = readJson("config/tsconfig/oxlint.json") as OxlintTsconfig;
|
|
|
|
expect(tsconfig.include).toContain("../../scripts/**/*");
|
|
});
|
|
|
|
it("has a discoverable scripts tsconfig for type-aware linting", () => {
|
|
const tsconfig = readJson("scripts/tsconfig.json") as OxlintTsconfig;
|
|
|
|
expect(tsconfig.include).toContain("**/*.ts");
|
|
expect(tsconfig.exclude ?? []).not.toContain("**/*.ts");
|
|
});
|
|
|
|
it("has a discoverable test tsconfig for type-aware linting", () => {
|
|
const tsconfig = readJson("test/tsconfig.json") as OxlintTsconfig;
|
|
|
|
expect(tsconfig.include).toContain("**/*.ts");
|
|
expect(tsconfig.exclude ?? []).not.toContain("**/*.ts");
|
|
});
|
|
|
|
it("does not ignore the bundled extensions tree", () => {
|
|
const config = readJson(".oxlintrc.json") as OxlintConfig;
|
|
|
|
expect(config.ignorePatterns ?? []).not.toContain("extensions/");
|
|
});
|
|
|
|
it("keeps generated and vendored extension outputs ignored", () => {
|
|
const config = readJson(".oxlintrc.json") as OxlintConfig;
|
|
const ignorePatterns = config.ignorePatterns ?? [];
|
|
|
|
expect(ignorePatterns).toEqual([
|
|
"dist/",
|
|
"dist-runtime/",
|
|
"docs/_layouts/",
|
|
"extensions/diffs/assets/viewer-runtime.js",
|
|
"extensions/diffs-language-pack/assets/viewer-runtime.js",
|
|
"extensions/canvas/src/host/a2ui/a2ui.bundle.js",
|
|
"node_modules/",
|
|
"patches/",
|
|
"pnpm-lock.yaml",
|
|
"skills/**",
|
|
"src/auto-reply/reply/export-html/template.js",
|
|
"src/canvas-host/a2ui/a2ui.bundle.js",
|
|
"vendor/",
|
|
"**/.cache/**",
|
|
"**/.openclaw-runtime-deps-copy-*/**",
|
|
"**/build/**",
|
|
"**/coverage/**",
|
|
"**/dist/**",
|
|
"**/dist-runtime/**",
|
|
"**/node_modules/**",
|
|
]);
|
|
});
|
|
|
|
it("keeps lint overrides limited to the explicit test-file carve-out", () => {
|
|
const config = readJson(".oxlintrc.json") as OxlintConfig;
|
|
|
|
expect(config.overrides).toEqual([
|
|
{
|
|
files: [
|
|
"**/*.test.ts",
|
|
"**/*.test.tsx",
|
|
"**/*.e2e.test.ts",
|
|
"**/*.live.test.ts",
|
|
"**/*test-harness.ts",
|
|
"**/*test-helpers.ts",
|
|
"**/*test-support.ts",
|
|
],
|
|
rules: {
|
|
"typescript/no-explicit-any": "off",
|
|
},
|
|
},
|
|
]);
|
|
});
|
|
|
|
it("enables strict empty object type lint with named single-extends interfaces allowed", () => {
|
|
const config = readJson(".oxlintrc.json") as OxlintConfig;
|
|
|
|
expect(config.rules?.["typescript/no-empty-object-type"]).toEqual([
|
|
"error",
|
|
{ allowInterfaces: "with-single-extends" },
|
|
]);
|
|
});
|
|
|
|
it("enables exhaustive switch linting", () => {
|
|
const config = readJson(".oxlintrc.json") as OxlintConfig;
|
|
|
|
expect(config.rules?.["typescript/switch-exhaustiveness-check"]).toEqual([
|
|
"error",
|
|
{ considerDefaultExhaustiveForUnions: true },
|
|
]);
|
|
});
|
|
|
|
it("enables clean zero-baseline lint rules", () => {
|
|
const config = readJson(".oxlintrc.json") as OxlintConfig;
|
|
|
|
for (const rule of ZERO_BASELINE_RULES) {
|
|
expect(config.rules?.[rule]).toBe("error");
|
|
}
|
|
});
|
|
});
|