Skip to content

Chrome DevTools for coding agents

refactor: list optional properties last in inline object types (#3302)

Nikolay Vitkovdc929c04b44c
diff --git a/src/TextSnapshot.ts b/src/TextSnapshot.ts
index a2aeb78a..5586cd8c 100644
--- a/src/TextSnapshot.ts
+++ b/src/TextSnapshot.ts
@@ -44,9 +44,9 @@ export class TextSnapshot {
root: TextSnapshotNode;
idToNode: Map<string, TextSnapshotNode>;
snapshotId: string;
- selectedElementUid?: string;
hasSelectedElement: boolean;
verbose: boolean;
+ selectedElementUid?: string;
}) {
this.root = data.root;
this.idToNode = data.idToNode;
diff --git a/src/devtools/DevtoolsUtils.ts b/src/devtools/DevtoolsUtils.ts
index 53a2a896..a9e9218a 100644
--- a/src/devtools/DevtoolsUtils.ts
+++ b/src/devtools/DevtoolsUtils.ts
@@ -252,9 +252,9 @@ export class SymbolizedError {
}
static async fromDetails(opts: {
- devTools?: TargetUniverse;
details: ExceptionDetailsLike;
targetId: string;
+ devTools?: TargetUniverse;
// The session that reported `details`. Remote object ids are scoped to
// the session that issued them, so the cause has to be resolved there.
session?: CDPSession;
@@ -315,9 +315,9 @@ export class SymbolizedError {
}
static async fromError(opts: {
- devTools?: TargetUniverse;
error: RemoteObjectLike;
targetId: string;
+ devTools?: TargetUniverse;
session?: CDPSession;
}): Promise<SymbolizedError> {
const details = await SymbolizedError.#getExceptionDetails(
diff --git a/src/formatters/ConsoleFormatter.ts b/src/formatters/ConsoleFormatter.ts
index 7b5ed301..a09e4d8e 100644
--- a/src/formatters/ConsoleFormatter.ts
+++ b/src/formatters/ConsoleFormatter.ts
@@ -84,12 +84,12 @@ export class ConsoleFormatter {
id: number;
type: string;
text: string;
+ isIgnored: IgnoreCheck;
argCount?: number;
resolvedArgs?: unknown[];
stack?: DevTools.DevTools.StackTrace.StackTrace.StackTrace;
cause?: SymbolizedError;
includeStackInConcise?: boolean;
- isIgnored: IgnoreCheck;
}) {
this.#id = params.id;
this.#type = params.type;
@@ -332,10 +332,10 @@ export class GroupedConsoleFormatter extends ConsoleFormatter {
type: string;
text: string;
argCount: number;
+ isIgnored: IgnoreCheck;
stack?: DevTools.DevTools.StackTrace.StackTrace.StackTrace;
cause?: SymbolizedError;
includeStackInConcise?: boolean;
- isIgnored: IgnoreCheck;
},
count: number,
) {
diff --git a/src/formatters/CssFormatter.ts b/src/formatters/CssFormatter.ts
index 2f4e7feb..330f2ab4 100644
--- a/src/formatters/CssFormatter.ts
+++ b/src/formatters/CssFormatter.ts
@@ -13,8 +13,8 @@ export type ContainerQuery =
export interface ResolvedContainerDetails {
container?: {
- uid?: string;
selector: string;
+ uid?: string;
};
}
@@ -52,8 +52,8 @@ export type AncestorCSSRule =
query: string;
name?: string;
container?: {
- uid?: string;
selector: string;
+ uid?: string;
};
}
| {
@@ -102,8 +102,8 @@ export interface MatchedRule {
export interface InheritedRule {
type: 'inherited';
node: {
- uid?: string;
selector: string;
+ uid?: string;
};
selector?: string;
matchingSelectors?: string[];
@@ -116,8 +116,8 @@ export interface PseudoElementRule {
type: 'pseudo';
pseudoType: string;
node?: {
- uid?: string;
selector: string;
+ uid?: string;
};
selector?: string;
matchingSelectors?: string[];
@@ -504,7 +504,7 @@ function getParentNodeInfo(
style: DevTools.CSSStyleDeclaration.CSSStyleDeclaration,
matchedStyles: MatchedStyles,
resolveUid?: UidResolver,
-): {uid?: string; selector: string} | undefined {
+): {selector: string; uid?: string} | undefined {
if (!matchedStyles.isInherited?.(style)) {
return undefined;
}
@@ -550,8 +550,8 @@ function getCascadeRuleHeader(rule: CascadeRule): string {
}
function formatAncestorRuleHeader(ancestor: AncestorCSSRule): {
- comment?: string;
header: string;
+ comment?: string;
} {
switch (ancestor.type) {
case 'layer':
diff --git a/src/telemetry/ClearcutLogger.ts b/src/telemetry/ClearcutLogger.ts
index b3b0a1cd..6ea6ec57 100644
--- a/src/telemetry/ClearcutLogger.ts
+++ b/src/telemetry/ClearcutLogger.ts
@@ -258,8 +258,8 @@ export class ClearcutLogger {
}
async logServerError(args: {
- toolName?: string;
errorCode: ErrorCode;
+ toolName?: string;
}): Promise<void> {
this.#watchdog.send({
type: WatchdogMessageType.LOG_EVENT,
diff --git a/src/tools/ToolDefinition.ts b/src/tools/ToolDefinition.ts
index 74d162e9..73af5e40 100644
--- a/src/tools/ToolDefinition.ts
+++ b/src/tools/ToolDefinition.ts
@@ -122,12 +122,12 @@ export interface BaseToolDefinition<Schema extends ToolSchema = ToolSchema> {
name: string;
description: string;
annotations: {
- title?: string;
category: ToolCategory;
/**
* If true, the tool does not modify its environment.
*/
readOnlyHint: boolean;
+ title?: string;
/**
* If `'slim'` is included, the tool is only available with `--slim`. Tools
* without `'slim'` are only available without `--slim`, see
@@ -211,7 +211,6 @@ export interface LighthouseData {
summary: {
mode: string;
device: string;
- url?: string;
scores: Array<{
id: string;
title: string;
@@ -224,6 +223,7 @@ export interface LighthouseData {
timing: {
total: number;
};
+ url?: string;
};
failedAudits: LighthouseFailedAudit[];
reports: string[];
diff --git a/src/tools/script.ts b/src/tools/script.ts
index ea81171f..cfc27078 100644
--- a/src/tools/script.ts
+++ b/src/tools/script.ts
@@ -244,7 +244,7 @@ const performEvaluation = async (
format: 'function' | 'script',
args: Array<JSHandle<unknown>>,
response: Response,
- options: {filePath?: string; context: Context},
+ options: {context: Context; filePath?: string},
): Promise<void> => {
let result: string | undefined;
if (format === 'function') {