mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:10:45 +00:00
build: enable new oxlint rules
This commit is contained in:
@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";
|
||||
|
||||
type OxlintConfig = {
|
||||
ignorePatterns?: string[];
|
||||
rules?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
type OxlintTsconfig = {
|
||||
@@ -16,40 +17,40 @@ function readJson(path: string): unknown {
|
||||
|
||||
describe("oxlint config", () => {
|
||||
it("includes bundled extensions in type-aware lint coverage", () => {
|
||||
const tsconfig = readJson<OxlintTsconfig>("tsconfig.oxlint.json");
|
||||
const tsconfig = readJson("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<OxlintTsconfig>("tsconfig.oxlint.json");
|
||||
const tsconfig = readJson("tsconfig.oxlint.json") as OxlintTsconfig;
|
||||
|
||||
expect(tsconfig.include).toContain("scripts/**/*");
|
||||
});
|
||||
|
||||
it("has a discoverable scripts tsconfig for type-aware linting", () => {
|
||||
const tsconfig = readJson<OxlintTsconfig>("scripts/tsconfig.json");
|
||||
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<OxlintTsconfig>("test/tsconfig.json");
|
||||
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<OxlintConfig>(".oxlintrc.json");
|
||||
const config = readJson(".oxlintrc.json") as OxlintConfig;
|
||||
|
||||
expect(config.ignorePatterns ?? []).not.toContain("extensions/");
|
||||
});
|
||||
|
||||
it("keeps generated and vendored extension outputs ignored", () => {
|
||||
const config = readJson<OxlintConfig>(".oxlintrc.json");
|
||||
const config = readJson(".oxlintrc.json") as OxlintConfig;
|
||||
const ignorePatterns = config.ignorePatterns ?? [];
|
||||
|
||||
expect(ignorePatterns).toContain("**/node_modules/**");
|
||||
@@ -58,4 +59,13 @@ describe("oxlint config", () => {
|
||||
expect(ignorePatterns).toContain("**/coverage/**");
|
||||
expect(ignorePatterns).toContain("**/.cache/**");
|
||||
});
|
||||
|
||||
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" },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user