mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:10:45 +00:00
build: enable new oxlint rules
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
"eslint-plugin-unicorn/prefer-array-find": "error",
|
||||
"eslint/no-array-constructor": "error",
|
||||
"eslint/no-await-in-loop": "off",
|
||||
"eslint/no-empty-pattern": ["error", { "allowObjectPatternsAsParameters": false }],
|
||||
"eslint/no-new": "error",
|
||||
"eslint/no-object-constructor": "error",
|
||||
"eslint/no-return-assign": "error",
|
||||
@@ -26,6 +27,7 @@
|
||||
"oxc/no-async-endpoint-handlers": "error",
|
||||
"oxc/no-map-spread": "error",
|
||||
"typescript/consistent-return": "error",
|
||||
"typescript/no-empty-object-type": ["error", { "allowInterfaces": "with-single-extends" }],
|
||||
"typescript/no-explicit-any": "error",
|
||||
"typescript/no-extraneous-class": "error",
|
||||
"typescript/no-meaningless-void-operator": "error",
|
||||
|
||||
@@ -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