mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-24 07:01:49 +00:00
build: lint bundled extensions
This commit is contained in:
127
.oxlintrc.json
127
.oxlintrc.json
@@ -25,8 +25,8 @@
|
||||
"ignorePatterns": [
|
||||
"assets/",
|
||||
"dist/",
|
||||
"dist-runtime/",
|
||||
"docs/_layouts/",
|
||||
"extensions/",
|
||||
"node_modules/",
|
||||
"patches/",
|
||||
"pnpm-lock.yaml",
|
||||
@@ -34,6 +34,129 @@
|
||||
"src/auto-reply/reply/export-html/template.js",
|
||||
"src/canvas-host/a2ui/a2ui.bundle.js",
|
||||
"Swabble/",
|
||||
"vendor/"
|
||||
"vendor/",
|
||||
"**/.cache/**",
|
||||
"**/build/**",
|
||||
"**/coverage/**",
|
||||
"**/dist/**",
|
||||
"**/dist-runtime/**",
|
||||
"**/node_modules/**"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"**/*.test.ts",
|
||||
"**/*.test.tsx",
|
||||
"**/*.e2e.test.ts",
|
||||
"**/*.live.test.ts",
|
||||
"**/*test-harness.ts",
|
||||
"**/*test-helpers.ts",
|
||||
"**/*test-support.ts"
|
||||
],
|
||||
"rules": {
|
||||
"typescript/await-thenable": "off",
|
||||
"typescript/no-base-to-string": "off",
|
||||
"typescript/no-explicit-any": "off",
|
||||
"typescript/no-floating-promises": "off",
|
||||
"typescript/no-misused-spread": "off",
|
||||
"typescript/no-redundant-type-constituents": "off",
|
||||
"typescript/no-unnecessary-template-expression": "off",
|
||||
"typescript/unbound-method": "off",
|
||||
"eslint/no-unsafe-optional-chaining": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"extensions/matrix/src/matrix/sdk/idb-persistence.ts",
|
||||
"extensions/matrix/src/matrix/sdk/idb-persistence.test-helpers.ts"
|
||||
],
|
||||
"rules": {
|
||||
"unicorn/prefer-add-event-listener": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["extensions/matrix/src/matrix/sdk/verification-manager.ts"],
|
||||
"rules": {
|
||||
"typescript/no-unsafe-enum-comparison": "off",
|
||||
"typescript/no-redundant-type-constituents": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["extensions/tlon/src/monitor/**/*.ts"],
|
||||
"rules": {
|
||||
"typescript/no-explicit-any": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["extensions/xai/**/*.ts"],
|
||||
"rules": {
|
||||
"typescript/no-redundant-type-constituents": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"extensions/diffs/src/store.ts",
|
||||
"extensions/matrix/src/matrix/sdk/crypto-facade.ts",
|
||||
"extensions/matrix/src/matrix/sdk/types.ts",
|
||||
"extensions/microsoft-foundry/shared.ts",
|
||||
"extensions/msteams/src/streaming-message.ts",
|
||||
"extensions/nostr/src/channel.ts"
|
||||
],
|
||||
"rules": {
|
||||
"typescript/no-redundant-type-constituents": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"extensions/anthropic-vertex/index.ts",
|
||||
"extensions/diagnostics-otel/src/service.ts",
|
||||
"extensions/feishu/index.ts",
|
||||
"extensions/mattermost/src/mattermost/monitor.ts",
|
||||
"extensions/nostr/src/nostr-profile.ts",
|
||||
"extensions/synology-chat/src/inbound-turn.ts",
|
||||
"extensions/telegram/src/pairing-text.ts"
|
||||
],
|
||||
"rules": {
|
||||
"typescript/await-thenable": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["extensions/discord/src/monitor/message-utils.ts"],
|
||||
"rules": {
|
||||
"typescript/no-unsafe-enum-comparison": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"extensions/discord/src/doctor.ts",
|
||||
"extensions/feishu/src/external-keys.ts",
|
||||
"extensions/feishu/src/media.ts",
|
||||
"extensions/qqbot/src/utils/platform.ts",
|
||||
"extensions/slack/src/doctor.ts",
|
||||
"extensions/telegram/src/doctor.ts",
|
||||
"extensions/voice-call/src/media-stream.ts",
|
||||
"extensions/voice-call/src/webhook.ts",
|
||||
"extensions/zalouser/src/doctor.ts",
|
||||
"extensions/zalouser/src/text-styles.ts"
|
||||
],
|
||||
"rules": {
|
||||
"eslint/no-control-regex": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["extensions/qqbot/src/outbound.ts"],
|
||||
"rules": {
|
||||
"typescript/no-explicit-any": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"extensions/openshell/src/backend.ts",
|
||||
"extensions/memory-core/src/memory/manager.ts"
|
||||
],
|
||||
"rules": {
|
||||
"typescript/no-this-alias": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
41
test/scripts/oxlint-config.test.ts
Normal file
41
test/scripts/oxlint-config.test.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import fs from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
type OxlintConfig = {
|
||||
ignorePatterns?: string[];
|
||||
};
|
||||
|
||||
type OxlintTsconfig = {
|
||||
include?: string[];
|
||||
exclude?: string[];
|
||||
};
|
||||
|
||||
function readJson<T>(path: string): T {
|
||||
return JSON.parse(fs.readFileSync(path, "utf8")) as T;
|
||||
}
|
||||
|
||||
describe("oxlint config", () => {
|
||||
it("includes bundled extensions in type-aware lint coverage", () => {
|
||||
const tsconfig = readJson<OxlintTsconfig>("tsconfig.oxlint.json");
|
||||
|
||||
expect(tsconfig.include).toContain("extensions/**/*");
|
||||
expect(tsconfig.exclude ?? []).not.toContain("extensions");
|
||||
});
|
||||
|
||||
it("does not ignore the bundled extensions tree", () => {
|
||||
const config = readJson<OxlintConfig>(".oxlintrc.json");
|
||||
|
||||
expect(config.ignorePatterns ?? []).not.toContain("extensions/");
|
||||
});
|
||||
|
||||
it("keeps generated and vendored extension outputs ignored", () => {
|
||||
const config = readJson<OxlintConfig>(".oxlintrc.json");
|
||||
const ignorePatterns = config.ignorePatterns ?? [];
|
||||
|
||||
expect(ignorePatterns).toContain("**/node_modules/**");
|
||||
expect(ignorePatterns).toContain("**/dist/**");
|
||||
expect(ignorePatterns).toContain("**/build/**");
|
||||
expect(ignorePatterns).toContain("**/coverage/**");
|
||||
expect(ignorePatterns).toContain("**/.cache/**");
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["src/**/*", "ui/**/*", "packages/**/*", "test/**/*"],
|
||||
"exclude": ["node_modules", "dist", "extensions"]
|
||||
"include": ["src/**/*", "ui/**/*", "packages/**/*", "extensions/**/*", "test/**/*"],
|
||||
"exclude": ["node_modules", "dist", "dist-runtime"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user