mirror of
https://github.com/ChromeDevTools/chrome-devtools-mcp.git
synced 2026-11-04 05:02:31 +00:00
refactor: list optional properties last in inline object types (#3302)
Stacked on #3301. Reorders 15 inline object types in 7 source files so that optional properties come after required ones. The change only affects types. This matches the DevTools [`enforce-optional-properties-last`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/scripts/eslint_rules/lib/enforce-optional-properties-last.ts) ESLint rule. Its autofix is not used because it moves properties without their JSDoc comments (for example, the `readOnlyHint` comment in `ToolDefinition.ts` would end up on `title`). ## User-visible changes None. ## Testing - `npm run format` - `npm run test`
This commit is contained in:
1 parent
2e13311bb3
commit
dc929c04b4
7 files changed
+15
-15
No files matched your search
+1
-1
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
) {
|
||||
|
||||
@@ -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':
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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[];
|
||||
|
||||
+1
-1
@@ -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') {
|
||||
|
||||
Reference in new issue
Block a user