Switch to double quotes and reformat codebase with Biome

This commit is contained in:
Mohamed Boudra
2026-03-21 20:22:15 +07:00
parent ab40786882
commit f6579dbeb4
805 changed files with 38132 additions and 40175 deletions
+1 -4
View File
@@ -9,10 +9,7 @@ export function resolveKeyboardFocusScope(input: {
return commandCenterOpen ? "command-center" : "other";
}
if (
target.closest("[data-testid='terminal-surface']") ||
target.closest(".xterm")
) {
if (target.closest("[data-testid='terminal-surface']") || target.closest(".xterm")) {
return "terminal";
}
@@ -1,8 +1,4 @@
export type KeyboardActionScope =
| "global"
| "message-input"
| "sidebar"
| "workspace";
export type KeyboardActionScope = "global" | "message-input" | "sidebar" | "workspace";
export type KeyboardActionId =
| "message-input.focus"
@@ -19,7 +19,7 @@ function keyboardEvent(overrides: Partial<KeyboardEvent>): KeyboardEvent {
}
function shortcutContext(
overrides: Partial<KeyboardShortcutContext> = {}
overrides: Partial<KeyboardShortcutContext> = {},
): KeyboardShortcutContext {
return {
isMac: false,
@@ -260,7 +260,14 @@ describe("keyboard-shortcuts", () => {
},
];
it.each(matchingCases)("$name", ({ event, context, action, payload, preventDefault, stopPropagation }) => {
it.each(matchingCases)("$name", ({
event,
context,
action,
payload,
preventDefault,
stopPropagation,
}) => {
expectShortcutResolution({
event,
context,
@@ -334,10 +341,7 @@ describe("keyboard-shortcuts", () => {
});
describe("keyboard-shortcut help sections", () => {
function findRow(
sections: ReturnType<typeof buildKeyboardShortcutHelpSections>,
id: string
) {
function findRow(sections: ReturnType<typeof buildKeyboardShortcutHelpSections>, id: string) {
for (const section of sections) {
const row = section.rows.find((candidate) => candidate.id === id);
if (row) {
+12 -30
View File
@@ -97,10 +97,7 @@ interface ShortcutBinding {
// --- Constants ---
const SHORTCUT_HELP_SECTION_TITLES: Record<
KeyboardShortcutHelpSection["id"],
string
> = {
const SHORTCUT_HELP_SECTION_TITLES: Record<KeyboardShortcutHelpSection["id"], string> = {
global: "Global",
"agent-input": "Agent Input",
};
@@ -724,32 +721,24 @@ function matchesCombo(combo: KeyCombo, event: KeyboardEvent): boolean {
}
const codeMatch = event.code === combo.code;
const keyMatch =
combo.key !== undefined &&
event.key.toLowerCase() === combo.key.toLowerCase();
const keyMatch = combo.key !== undefined && event.key.toLowerCase() === combo.key.toLowerCase();
return codeMatch || keyMatch;
}
function matchesWhen(
when: ShortcutWhen | undefined,
context: KeyboardShortcutContext
): boolean {
function matchesWhen(when: ShortcutWhen | undefined, context: KeyboardShortcutContext): boolean {
if (!when) return true;
if (when.mac !== undefined && when.mac !== context.isMac) return false;
if (when.desktop !== undefined && when.desktop !== context.isDesktop)
return false;
if (when.terminal === false && context.focusScope === "terminal")
return false;
if (when.desktop !== undefined && when.desktop !== context.isDesktop) return false;
if (when.terminal === false && context.focusScope === "terminal") return false;
if (when.commandCenter === false && context.commandCenterOpen) return false;
if (when.hasSelectedAgent === true && !context.hasSelectedAgent) return false;
if (when.focusScope !== undefined && context.focusScope !== when.focusScope)
return false;
if (when.focusScope !== undefined && context.focusScope !== when.focusScope) return false;
return true;
}
function resolvePayload(
def: ShortcutPayloadDef | undefined,
event: KeyboardEvent
event: KeyboardEvent,
): KeyboardShortcutPayload {
if (!def) return null;
switch (def.type) {
@@ -766,11 +755,10 @@ function resolvePayload(
function helpMatchesPlatform(
when: ShortcutWhen | undefined,
context: KeyboardShortcutPlatformContext
context: KeyboardShortcutPlatformContext,
): boolean {
if (when?.mac !== undefined && when.mac !== context.isMac) return false;
if (when?.desktop !== undefined && when.desktop !== context.isDesktop)
return false;
if (when?.desktop !== undefined && when.desktop !== context.isDesktop) return false;
return true;
}
@@ -799,13 +787,10 @@ export function resolveKeyboardShortcut(input: {
}
export function buildKeyboardShortcutHelpSections(
input: KeyboardShortcutPlatformContext
input: KeyboardShortcutPlatformContext,
): KeyboardShortcutHelpSection[] {
const seenRows = new Set<string>();
const rowsBySection = new Map<
KeyboardShortcutHelpSection["id"],
KeyboardShortcutHelpRow[]
>([
const rowsBySection = new Map<KeyboardShortcutHelpSection["id"], KeyboardShortcutHelpRow[]>([
["global", []],
["agent-input", []],
]);
@@ -836,10 +821,7 @@ export function buildKeyboardShortcutHelpSections(
});
}
const sectionOrder: KeyboardShortcutHelpSection["id"][] = [
"global",
"agent-input",
];
const sectionOrder: KeyboardShortcutHelpSection["id"][] = ["global", "agent-input"];
return sectionOrder.flatMap((sectionId) => {
const rows = rowsBySection.get(sectionId) ?? [];