chore: Enable more lint rules, disable some that trigger a lot. Will clean up later.

This commit is contained in:
cpojer
2026-01-31 16:03:28 +09:00
parent 481f696a87
commit 15792b153f
292 changed files with 643 additions and 699 deletions

View File

@@ -33,7 +33,7 @@ metadata:
const result = parseFrontmatterBlock(content);
expect(result.metadata).toBeDefined();
const parsed = JSON5.parse(result.metadata ?? "") as { openclaw?: { emoji?: string } };
const parsed = JSON5.parse(result.metadata ?? "");
expect(parsed.openclaw?.emoji).toBe("disk");
});
@@ -65,7 +65,7 @@ metadata:
expect(result.enabled).toBe("true");
expect(result.retries).toBe("3");
expect(JSON.parse(result.tags ?? "[]")).toEqual(["alpha", "beta"]);
const parsed = JSON5.parse(result.metadata ?? "") as { openclaw?: { events?: string[] } };
const parsed = JSON5.parse(result.metadata ?? "");
expect(parsed.openclaw?.events).toEqual(["command:new"]);
});

View File

@@ -655,7 +655,7 @@ function clampLinkSpans(spans: MarkdownLinkSpan[], maxLength: number): MarkdownL
}
function mergeStyleSpans(spans: MarkdownStyleSpan[]): MarkdownStyleSpan[] {
const sorted = [...spans].sort((a, b) => {
const sorted = [...spans].toSorted((a, b) => {
if (a.start !== b.start) return a.start - b.start;
if (a.end !== b.end) return a.end - b.end;
return a.style.localeCompare(b.style);

View File

@@ -34,7 +34,7 @@ const STYLE_RANK = new Map<MarkdownStyle, number>(
);
function sortStyleSpans(spans: MarkdownStyleSpan[]): MarkdownStyleSpan[] {
return [...spans].sort((a, b) => {
return [...spans].toSorted((a, b) => {
if (a.start !== b.start) return a.start - b.start;
if (a.end !== b.end) return b.end - a.end;
return (STYLE_RANK.get(a.style) ?? 0) - (STYLE_RANK.get(b.style) ?? 0);
@@ -82,7 +82,7 @@ export function renderMarkdownWithMarkers(ir: MarkdownIR, options: RenderOptions
}
}
const points = [...boundaries].sort((a, b) => a - b);
const points = [...boundaries].toSorted((a, b) => a - b);
// Unified stack for both styles and links, tracking close string and end position
const stack: { close: string; end: number }[] = [];
type OpeningItem =